订单表tb_order包含用户信息uid和产品信息pid等属性列,以下语句能够返回至少被订购过三次的pid是()。
A: SELECT
pid FROM tb_order WHERE count(pid)>3;
B: SELECT
pid FROM tb_order WHERE max(pid)>=3;
C: SELECT
pid FROM tb_order GROUP BY pid HAVING COUNT(pid)>3;
D: SELECT
pid FROM tb_order GROUP BY pid HAVING COUNT(pid)>=3;
A: SELECT
pid FROM tb_order WHERE count(pid)>3;
B: SELECT
pid FROM tb_order WHERE max(pid)>=3;
C: SELECT
pid FROM tb_order GROUP BY pid HAVING COUNT(pid)>3;
D: SELECT
pid FROM tb_order GROUP BY pid HAVING COUNT(pid)>=3;
举一反三
- 【单选题】有订单表tb_order,包含用户信息userid, 商品信息goodsid, 以下()语句能够返回至少被购买两次的商品id。 A. SELECT goodsid FROM tb_order WHERE COUNT(goodsid)>1 B. SELECT goodsid FROM tb_order WHERE MAX(goodsid)>1 C. SELECT goodsid FROM tb_order GROUP BY goodsid HAVING COUNT(goodsid)>1 D. SELECT goodsid FROM tb_order WHERE HAVING COUNT(goodsid)>1 GROUP BY goodsid
- 若要求“查询选修了3门以上课程的学生的学号”,正确的SQL语句是( ) A: SELECT sNo FROM SC GROUP BY sNo WHERE COUNT(*)> 3 B: SELECT sNo FROM SC GROUP BY sNo HAVING COUNT(*)> 3 C: SELECT sNo FROM SC ORDER BY sNo WHERE COUNT(*)> 3 D: SELECT sNo FROM SC ORDER BY sNo HAVING COUNT(*)> 3
- 以下SQL子句的撰写顺序表达正确的是: A: SELECT、FROM、WHERE、GROUP BY、HAVING、ORDER BY B: SELECT、FROM、WHERE、HAVING、GROUP BY、ORDER BY C: SELECT、FROM、WHERE、ORDER BY、HAVING、GROUP BY D: SELECT、FROM、ORDER BY、WHERE、GROUP BY、HAVING
- 统计各系男生人数,最准确的SQL语句是(<br/>)。 A: SELECT<br/>COUNT(*) FROM stduents GROUP BY d_no WHERE sex='男' B: SELECT<br/>COUNT(*) FROM students WHERE sex='男'<br/>GROUP BY d_no C: SELECT<br/>COUNT(*) FROM students WHERE sex='男'<br/>ORDER BY d_no D: SELECT<br/>COUNT(*) FROM students HAVING sex='男'<br/>GROUP BY d_no
- 查询最少选修了3门课程的学生学号和姓名,正确的SQL语句是()。 A: SELECT 学号,姓名,COUNT(*) FROM 选课成绩 WHERE COUNT(*)>=3 GROUP BY 学号 B: SELECT 学号,姓名,COUNT(*) FROM选课成绩 WHERE COUNT(*)>=3 GROUP BY学号,姓名 C: SELECT 学号,姓名,COUNT(*) FROM 选课成绩 GROUP BY学号HAVING COUNT(*)>=3 D: SELECT 学号,姓名,COUNT(*) FROM 选课成绩 GROUP BY学号,姓名 HAVING COUNT(*)>=3