notesonly.in

One notebook for every subject — open it anywhere.

Log in

SQL: queries, joins, subqueries, views

Database Management Systems · Engineering

Study notes

Find students and their course counts: SELECT s.name, COUNT(e.code) FROM Student s LEFT JOIN Enrolls e ON s.roll = e.roll GROUP BY s.name. LEFT JOIN keeps students with zero courses (count 0); INNER JOIN would drop them. A subquery alternative nests the count per student.

← Back to topics for Engineering