human
Schema:
Course_Authors_and_Tutors (author_id, author_tutor_ATB, login_name, password, personal_name, middle_name, family_name, gender_mf, address_line_1)
Students (student_id, date_of_registration, date_of_latest_logon, login_name, password, personal_name, middle_name, family_name)
Subjects (subject_id, subject_name)
Courses (course_id, author_id, subject_id, course_name, course_description)
Student_Course_Enrolment (registration_id, student_id, course_id, date_of_enrolment, date_of_completion)
Student_Tests_Taken (registration_id, date_test_taken, test_result)
Please answer with SQL.
assistant
Sure, I understand.
human
How many courses are there in Computer Science?
assistant
SELECT COUNT( * ) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Computer Science';
human
Great, and how many courses are there in Arts?
assistant
SELECT COUNT( * ) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Arts';
human
Wonderful. And how many courses in Language?
assistant
SELECT COUNT( * ) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = 'Language';
human
Great, can you sort a list of Computer Science, Arts, and Language by the number of courses, in ascending order?
assistant
SELECT T2.subject_name FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT( * ) ASC ;