Here are the tables:
CREATE TABLE [dbo].[Classes]( [ClassId] [int] NOT NULL, [ClassName] [nvarchar](50) NOT NULL, CONSTRAINT [PK_Classes] PRIMARY KEY CL
You need to do this -
SELECT C.ClassId, C.ClassName, count(S.StudentId) AS studentCount FROM CLASSES C LEFT JOIN STUDENTS S ON (C.ClassId=S.ClassId) GROUP BY C.ClassId, C.ClassName