We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
查出超过或等于 5 名学生的课(学生的课不被重复计算)
5
create table courses ( student varchar(255), class varchar(255) ) insert into courses values ('A', 'Math'), ('B', 'English'), ('C', 'Math'), ('D', 'Biology'), ('E', 'Math'), ('F', 'Computer'), ('G', 'Math'), ('H', 'Math'), ('I', 'Math');
select class from courses group by class having count(*) >= 5;
学生的课不重复,所以按照 class 分组,在使用 having 筛选出大于等于 5 课的同学
class
having
select class from ( select class, count(*) as num from courses group by class ) as c where num >= 5;
group by
The text was updated successfully, but these errors were encountered:
No branches or pull requests
题目
查出超过或等于
5
名学生的课(学生的课不被重复计算)SQL:方法一
解析
学生的课不重复,所以按照
class
分组,在使用having
筛选出大于等于5
课的同学SQL:方法二
解析
group by
分组5
人。The text was updated successfully, but these errors were encountered: