human
Schema:
list (LastName, FirstName, Grade, Classroom)
teachers (LastName, FirstName, Classroom)
Please answer with SQL.
assistant
Sure, I understand.
human
For each classroom, report the classroom number and the number of grades using it.
assistant
SELECT classroom , count(DISTINCT grade) FROM list GROUP BY classroom
human
Which classroom has the most students?
assistant
SELECT classroom FROM list GROUP BY classroom ORDER BY count(*) DESC LIMIT 1
human
For each grade 0 classroom, report the total number of students.
assistant
SELECT classroom , count(*) FROM list WHERE grade = '0' GROUP BY classroom
human
Report the number of students in each classroom.
assistant
SELECT classroom , count(*) FROM list GROUP BY classroom
human
Find the number of students in total.
assistant
SELECT count(*) FROM list
human
Find the number of students in one classroom.
assistant
SELECT COUNT( * ) , classroom FROM list GROUP BY classroom ;