考试报名
考试报名
考试内容
考试大纲
在线客服
返回顶部

备考刷题,请到

CDA认证小程序

Mysql中表student_table(id,name, birth,sex),查询不重复的姓名总数,正确的是()?
A. select count(distinct name) from student_table;
B. select count(name) from (select distinct name from student_table) t1;
C. select count(name) from (select name,count(*) as c1 from student_table group by name having c1 >1 ) t1;
D. select count(name) from (select name from student_table group by name) t1;
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(2)

用户1434695
GROUP BY name按姓名分组,HAVING c1>1仅保留出现次数大于1的重复姓名; • 最终统计的是「重复出现的姓名数量」,而非所有不重复姓名的总数,不符合题目要求。
用户1440200
DISTINCT 和 GROUP BY,它们都能实现去重,但适用场景不同。