求一sql语句
表结构如下:
表名student
id(自动增长类型) name(字符串类型)
1 张三
2 王二
3 李四
4 张三我想通过一个sql语句查询出来学生的数量,名字相同的为一个学生,即应当查询出来学生的
数量为3个,我通过下面的sql语句语法错误,请大家指正一下
select count(distinct name) from student
我想通过这个语句等到结果是:3,但语法错误
表结构如下:
表名student
id(自动增长类型) name(字符串类型)
1 张三
2 王二
3 李四
4 张三我想通过一个sql语句查询出来学生的数量,名字相同的为一个学生,即应当查询出来学生的
数量为3个,我通过下面的sql语句语法错误,请大家指正一下
select count(distinct name) from student
我想通过这个语句等到结果是:3,但语法错误
select count( distinct name) from student
--统计每个名字的数量
select name, count(*) from student
group by name