GROUP BY, WHERE✅✅✅ | no HAVING❌❌❌| Easy to understand |
Intuition\nThe problem is asking to find the classes that have more than 4 students. The first thought to solve this problem is to use the SQL GROUP BY clause t
# Intuition\nThe problem is asking to find the classes that have more than 4 students. The first thought to solve this problem is to use the SQL `GROUP BY` clause to group the records based on the class and then use the `COUNT` function to count the number of students in each class.\n\n# Approach\nThe approach to solving this problem is to first group the records in the courses table by class using the GROUP BY clause. Then, for each group, count the number of student using the `COUNT` function. This will give us the number of students in each class.\n\nNext, we select the classes where the count of students is greater than 4. This is done using a subquery where we select from the result of the previous step and filter the records where the count of students s is greater than 4.\n\n# Code\n```\n/* Write your PL/SQL query statement below */\nselect class\nfrom (\nselect count(student) as s , class\nfrom courses\ngroup by class \n)\nwhere s > 4\n```
['Oracle']