以下sql语句正确的是()

A. select studentid,depart,count(*) from student group by depart;
B. select studentid,count(*) from student ;
C. select depart, max(age) from student group by depart;
D. select studentid,avg(score),max(score) from score group by studentid;

参考解答

C D

分析

A 选项错误在于,分组时只用了depart列,这时select子句中只能出现组函数与depart列

B 选项错误在于,直接使用组函数,没有group by时,表示所有数据分为一组,这时select子句中只能出现组函数


results matching ""

    No results matching ""