human
Schema:
list (LastName, FirstName, Grade, Classroom)
teachers (LastName, FirstName, Classroom)
Please answer with SQL.
assistant
Sure, I understand.
human
Report the total number of students for each fourth-grade classroom.
assistant
SELECT classroom , count(*) FROM list WHERE grade = '4' GROUP BY classroom
human
For each classroom report the grade that is taught in it. Report just the classroom number and the grade number.
assistant
SELECT DISTINCT classroom , grade FROM list
human
Report the number of students in each classroom.
assistant
SELECT classroom , count(*) FROM list GROUP BY classroom
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
For each grade, report the grade, the number of classrooms in which it is taught and the total number of students in the grade.
assistant
SELECT grade , count(DISTINCT classroom) , count(*) FROM list GROUP BY grade
human
For each grade 0 classroom, report the total number of students.
assistant
SELECT classroom , COUNT( * ) FROM list WHERE grade = "0" GROUP BY classroom ;