SQL - Year wise Student Count
student is a database table containing whose create DDL is given below.
CREATE TABLE student(id int , name VARCHAR (100), department VARCHAR (3), year int ); |
Write the SQL to list the year wise count of the students.
(The year must be the first column in the resultset. The count of the students belonging to the specific year must be the second column in the resultset).
(The year must be the first column in the resultset. The count of the students belonging to the specific year must be the second column in the resultset).
SQL:
select
year, count(*) from student group by
year;
Please do comment If u have any Queries!
select year,count(id) from student group by year;
ReplyDelete