Each row of this table indicates the name of a student and the class in which they are enrolled. Write an SQL query to report all the classes that have at least five students. Return the result table in any order.
And then select the ones have more than 5 students. To get the student number in each class. We can use GROUP BY and COUNT, which is very popular used to statistic bases on some character in a table. Note: We use DISTINCT here since the student name may duplicated in a class as it is mentioned int he problem description.
You can use the HAVING clause to filter only those who have both Maths and ENG : If you want aditional books, just play with the WHERE and HAVING , for 3 change them to this: Show activity on this post. This should solve your problem. Note that we are doing a self join on three copies of the student_books table:
Query in SQL is like a statement that performs a task. Here, we need to write a query to find all the students whose marks are greater than the average marks of students. We will first create a database named “ geeks ” then we will create a table “ Students ” in that database. Attention reader!