作者bobju (宝贝猪)
看板Database
标题Re: [SQL ] 某公司的试题
时间Mon Feb 28 02:40:45 2011
结构是这样:
select city,count(*)
from Customer
group by city having count(*) >= 6
※ 引述《ami9897 (小新)》之铭言:
: Below is the customer table in database ABC.
: [Customer Table]:
: ID Name Salary City
: ====================================
: 1 Romeo 1000 Surabaya
: 2 Julia 3000 Ho chi min
: 3 Robert 2000 Hongkong
: ?
: 100 Deniro 5000 Singapore
: (total record = 100)
: (Id is Primary Key)
: Please provide a SQL script to query customer that his/her city occurs in
: the table more than or equal to 6.
: Example:
: The number of customer that live in hongkong is 10
: The number of customer that live in surabaya=5
: The number of customer that live in singapore=6.
: So in this example the output should be all customer that live in
: Singapore and Hongkong only.
: 到现在小弟还想不出来 不知版上大大是不是有想法
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 115.43.11.116
1F:→ zephyrhymn:靠呗~~~怎麽那麽像某大学硕班的考古题(指答案)XD!!! 03/01 21:48
2F:→ bobju:这种答案,会的人大概都是这麽写的.这题难度算低了. :( 03/02 11:59