human
Schema:
list (LastName, FirstName, Grade, Classroom)
teachers (LastName, FirstName, Classroom)
Please answer with SQL.
assistant
Sure, I understand.
human
Which classrooms are used by grade 5?
assistant
SELECT DISTINCT classroom FROM list WHERE grade = 5
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
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 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 grade is studying in classroom 103?
assistant
SELECT DISTINCT grade FROM list WHERE classroom = 103
human
What are the grade number and classroom number of each class in the list?
assistant
SELECT DISTINCT classroom , grade FROM list ;