Click here to see the full article post
Looks like this piece of code
Bonus ON Employee.empid = Bonus.empid
bonus < 1000 OR bonus IS NULL
should not be in this post.
GROUP BY class
HAVING COUNT(student) >= 5
what is the difference with or without distinct, I think any one even the same name can be counted, and it's not a major problem.
@glad2be, The Note at the very bottom states: "Note: The students should not be counted duplicate in each course." Thus you need the distinct.
select courses.class as class
group by courses.class
sorry Why can't I ues this way to soluve this problem?
(select class, count(*) as num
group by class
) as a
where num >= 5;
why it's wrong answer?
hello, I think you used count(*) instead of count(distinct student)
- cannot resolve the problem which described "no duplicate student".
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.