午夜精品久久久久久久99老熟妇,天堂中文www官网,未满十八18勿进黄网站,太粗太深了太紧太爽了,天天爽夜夜爽夜夜爽

考試報(bào)名
考試報(bào)名
考試內(nèi)容
考試大綱
在線客服
返回頂部

備考刷題,請(qǐng)到

CDA認(rèn)證小程序

The table "t1" has three columns: "id," "name," and "salary." If "t1" represents a forum's posting information table, where "id" is the poster's ID, "name" is the post's title, and "salary" is the score awarded for each post on the forum. The statement to display posts with more than 5 entries is:
A. select id, count(name) from t1 group by id;
B. select id, count(name) from t1 group by id having count(name)>5;
C. select id, count(name) from t1 group by id having count(name)>5 order by count(name);
D. select id, count(name) from t1 where id > 100 group by id;
上一題
下一題
收藏
點(diǎn)贊
評(píng)論
題目解析
題目評(píng)論(0)

After calculating the number of posts for each group using "count(name)," we want to output the results where the count is greater than 5 (count(name)>5). This requires using "having" to set the condition for filtering the results after grouping. The difficulty here lies in understanding the use of "having."

正確答案是:B: select id, count(name) from t1 group by id having count(name)>5;

專業(yè)分析:

1. **選項(xiàng)A**: `select id, count(name) from t1 group by id;`
- 這個(gè)語(yǔ)句會(huì)按照`id`分組,并計(jì)算每個(gè)`id`對(duì)應(yīng)的`name`的數(shù)量。但是,它沒(méi)有篩選出帖子數(shù)量大于5的條件。

2. **選項(xiàng)B**: `select id, count(name) from t1 group by id having count(name)>5;`
- 這個(gè)語(yǔ)句不僅按照`id`分組并計(jì)算每個(gè)`id`對(duì)應(yīng)的`name`的數(shù)量,還通過(guò)`having`子句篩選出帖子數(shù)量大于5的記錄。因此,這是正確的答案。

3. **選項(xiàng)C**: `select id, count(name) from t1 group by id having count(name)>5 order by count(name);`
- 這個(gè)語(yǔ)句與選項(xiàng)B類似,但多了一個(gè)`order by`子句,用于按帖子數(shù)量排序。雖然語(yǔ)法正確,但題目只要求篩選出帖子數(shù)量大于5的記錄,并沒(méi)有要求排序,因此不是最佳答案。

4. **選項(xiàng)D**: `select id, count(name) from t1 where id > 100 group by id;`
- 這個(gè)語(yǔ)句在分組之前增加了一個(gè)`where`條件,篩選出`id`大于100的記錄。這個(gè)條件與題目要求無(wú)關(guān),因此不是正確答案。

綜上所述,選項(xiàng)B最符合題目要求。