aherntech/sparc huggingface dataset:
Database: college_2
Question sequence:
What are the ids of instructors who taught courses?
What are the ids of all other instructors?
What are their names?
SQL query sequence:
SELECT id FROM teaches
SELECT id FROM instructor WHERE id NOT IN (SELECT id FROM teaches)
SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches)
Final question: What are the names of instructors who didn't teach?
Final SQL: SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches)
Database: college_2
Question sequence:
What are the ids of instructors who taught courses?
What are the ids of all other instructors?
SQL query sequence:
SELECT id FROM teaches
SELECT id FROM instructor EXCEPT SELECT id FROM teaches
Final question: What are the ids of instructors who didnt' teach?
Final SQL: SELECT id FROM instructor EXCEPT SELECT id FROM teaches
Database: college_2
Question sequence:
What are the ids of teachers who taught in the Spring?
What are the ids of all other instructors?
What are the corresponding instructor names?
SQL query sequence:
SELECT id FROM teaches WHERE semester  =  'Spring'
SELECT id FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester  =  'Spring')
SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester  =  'Spring')
Final question: What are the names of instructors who didn't teach courses in the Spring?
Final SQL: SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester  =  'Spring')
Database: college_2
Question sequence:
What are the average instructor salaries for each department?
Which department has the highest?
SQL query sequence:
SELECT dept_name ,  avg(salary) FROM instructor GROUP BY dept_name
SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY avg(salary) DESC LIMIT 1
Final question: Which department has the highest average instructor salary?
Final SQL: SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY avg(salary) DESC LIMIT 1
Database: college_2
Question sequence:
Order the departments by decreasing budget.
How many instructors are in the department with the highest budget?
Also, what is the average salary of those instructors?
SQL query sequence:
SELECT dept_name FROM department ORDER BY budget DESC
SELECT count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name  =  T2.dept_name ORDER BY T2.budget DESC LIMIT 1
SELECT avg(T1.salary) ,  count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name  =  T2.dept_name ORDER BY T2.budget DESC LIMIT 1
Final question: How many instructors are in the department with the highest budget, and what is their average salary?
Final SQL: SELECT avg(T1.salary) ,  count(*) FROM instructor AS T1 JOIN department AS T2 ON T1.dept_name  =  T2.dept_name ORDER BY T2.budget DESC LIMIT 1
Database: college_2
Question sequence:
What is the maximum capacity of any classroom?
What is the title of the course which is taught there?
Also, what credits value does that course have?
SQL query sequence:
SELECT max(capacity) FROM classroom
SELECT T3.title FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building  =  T2.building AND T1.room_number  =  T2.room_number JOIN course AS T3 ON T2.course_id  =  T3.course_id WHERE T1.capacity  =  (SELECT max(capacity) FROM classroom)
SELECT T3.title ,  T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building  =  T2.building AND T1.room_number  =  T2.room_number JOIN course AS T3 ON T2.course_id  =  T3.course_id WHERE T1.capacity  =  (SELECT max(capacity) FROM classroom)
Final question: Give the title and credits for the course that is taught in the classroom with the greatest capacity.
Final SQL: SELECT T3.title ,  T3.credits FROM classroom AS T1 JOIN SECTION AS T2 ON T1.building  =  T2.building AND T1.room_number  =  T2.room_number JOIN course AS T3 ON T2.course_id  =  T3.course_id WHERE T1.capacity  =  (SELECT max(capacity) FROM classroom)
Database: college_2
Question sequence:
Which students have taken Biology courses?
What are the names of all students who did not take that class?
SQL query sequence:
SELECT * FROM takes AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.dept_name  =  'Biology'
SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.dept_name  =  'Biology')
Final question: What are the names of students who haven't taken any Biology courses?
Final SQL: SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id  =  T2.course_id WHERE T2.dept_name  =  'Biology')
Database: college_2
Question sequence:
Find the total number of students.
Now, find the number by department.
Also, find the number of instructors in each department.
SQL query sequence:
SELECT count(DISTINCT id) FROM student
SELECT count(DISTINCT T2.id) ,  T1.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name  =  T2.dept_name GROUP BY T1.dept_name
SELECT count(DISTINCT T2.id) ,  count(DISTINCT T3.id) ,  T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name  =  T2.dept_name JOIN instructor AS T3 ON T1.dept_name  =  T3.dept_name GROUP BY T3.dept_name
Final question: How many students and instructors are in each department?
Final SQL: SELECT count(DISTINCT T2.id) ,  count(DISTINCT T3.id) ,  T3.dept_name FROM department AS T1 JOIN student AS T2 ON T1.dept_name  =  T2.dept_name JOIN instructor AS T3 ON T1.dept_name  =  T3.dept_name GROUP BY T3.dept_name
Database: college_2
Question sequence:
What is the id of the prerequisite of International Finance?
What are the ids of students who have taken this course?
What are their names?
SQL query sequence:
SELECT T2.prereq_id FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id WHERE T1.title  =  'International Finance'
SELECT T1.id FROM student AS T1 JOIN takes AS T2 ON T1.id  =  T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id  =  T4.course_id WHERE T3.title  =  'International Finance')
SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id  =  T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id  =  T4.course_id WHERE T3.title  =  'International Finance')
Final question: What are the names of students who have taken the prerequisite for the course International Finance?
Final SQL: SELECT T1.name FROM student AS T1 JOIN takes AS T2 ON T1.id  =  T2.id WHERE T2.course_id IN (SELECT T4.prereq_id FROM course AS T3 JOIN prereq AS T4 ON T3.course_id  =  T4.course_id WHERE T3.title  =  'International Finance')
Database: college_2
Question sequence:
What is the average salary of instructors in the Physics department?
What are the names of the instructors who earn more than that?
Also, what are their salaries?
SQL query sequence:
SELECT avg(salary) FROM instructor WHERE dept_name  =  'Physics'
SELECT name FROM instructor WHERE salary  <  (SELECT avg(salary) FROM instructor WHERE dept_name  =  'Physics')
SELECT name ,  salary FROM instructor WHERE salary  <  (SELECT avg(salary) FROM instructor WHERE dept_name  =  'Physics')
Final question: What are the names and salaries for instructors who earn less than the average salary of instructors in the Physics department?
Final SQL: SELECT name ,  salary FROM instructor WHERE salary  <  (SELECT avg(salary) FROM instructor WHERE dept_name  =  'Physics')
Database: college_2
Question sequence:
What is all the information about the Statistics courses?
What are the names of students who have taken courses in the Statistics department?
SQL query sequence:
SELECT * FROM course WHERE dept_name  =  'Statistics'
SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id  =  T2.course_id JOIN student AS T3 ON T2.id  =  T3.id WHERE T1.dept_name  =  'Statistics'
Final question: What are the names of students who have taken Statistics courses?
Final SQL: SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id  =  T2.course_id JOIN student AS T3 ON T2.id  =  T3.id WHERE T1.dept_name  =  'Statistics'
Database: college_2
Question sequence:
What is all the information about the courses in the Psychology department, ordered by title?
What are the building, room number, semester and year corresponding to these courses?
SQL query sequence:
SELECT * FROM course WHERE dept_name  =  'Psychology' ORDER BY title
SELECT T2.building ,  T2.room_number ,  T2.semester ,  T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id  =  T2.course_id WHERE T1.dept_name  =  'Psychology' ORDER BY T1.title
Final question: What are the building, room number, semester and year of courses in the Psychology department, sorted using course title?
Final SQL: SELECT T2.building ,  T2.room_number ,  T2.semester ,  T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id  =  T2.course_id WHERE T1.dept_name  =  'Psychology' ORDER BY T1.title
Database: college_2
Question sequence:
What are the names of all the instructors?
Of those, which are in the Comp. Sci. department?
SQL query sequence:
SELECT name FROM instructor
SELECT name FROM instructor WHERE dept_name  =  'Comp. Sci.'
Final question: What are the names of all instructors in the Comp. Sci. department?
Final SQL: SELECT name FROM instructor WHERE dept_name  =  'Comp. Sci.'
Database: college_2
Question sequence:
What are the names of all instructors who earn more than 80000?
Of those, which are in the Comp. Sci. department?
SQL query sequence:
SELECT name FROM instructor WHERE salary  >  80000
SELECT name FROM instructor WHERE dept_name  =  'Comp. Sci.'  AND salary  >  80000
Final question: What are the names of the instructors in the Comp. Sci. department who earn more than 80000?
Final SQL: SELECT name FROM instructor WHERE dept_name  =  'Comp. Sci.'  AND salary  >  80000
Database: college_2
Question sequence:
What are all the names of teachers who have taught a course?
Also, what were the course ids?
SQL query sequence:
SELECT name FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID
SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID
Final question: What are the names of all instructors who have taught a course, as well as the corresponding course id?
Final SQL: SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID
Database: college_2
Question sequence:
What are all the names of teachers who have taught a course, and what were the course ids?
Of these, which were in the Art department?
SQL query sequence:
SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID
SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID WHERE T1.dept_name  =  'Art'
Final question: What are the names of Art instructors who have taught a course, and the corresponding course id?
Final SQL: SELECT name ,  course_id FROM instructor AS T1 JOIN teaches AS T2 ON T1.ID  =  T2.ID WHERE T1.dept_name  =  'Art'
Database: college_2
Question sequence:
What are the names of all instructors?
Of these, which include the substring "dar"?
SQL query sequence:
SELECT name FROM instructor
SELECT name FROM instructor WHERE name LIKE '%dar%'
Final question: What are the names of all instructors with names that include "dar"?
Final SQL: SELECT name FROM instructor WHERE name LIKE '%dar%'
Database: college_2
Question sequence:
What are the distinct names of all instructors?
Sort this in alphabetical order.
SQL query sequence:
SELECT DISTINCT name FROM  instructor
SELECT DISTINCT name FROM  instructor ORDER BY name
Final question: List the distinct names of the instructors, ordered by name.
Final SQL: SELECT DISTINCT name FROM  instructor ORDER BY name
Database: college_2
Question sequence:
What are the ids for courses offered in the Fall of 2009?
Also include the ids for courses offered in the Spring of 2010.
SQL query sequence:
SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009
SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 UNION SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010
Final question: What are the ids for courses in the Fall of 2009 or the Spring of 2010?
Final SQL: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 UNION SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010
Database: college_2
Question sequence:
What are the ids for courses offered in the Fall of 2009?
Of these, which were also offered in the Spring of 2010?
SQL query sequence:
SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009
SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 INTERSECT SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010
Final question: What are the ids for courses that were offered in both Fall of 2009 and Spring of 2010?
Final SQL: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 INTERSECT SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010
Database: college_2
Question sequence:
What are the ids of courses offered in the Fall of 2009?
Of these, which were not offered in the Spring of 2010?
SQL query sequence:
SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009
SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 EXCEPT SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010
Final question: What are the ids of courses offered in Fall of 2009 but not in Spring of 2010?
Final SQL: SELECT course_id FROM SECTION WHERE semester  =  'Fall' AND YEAR  =  2009 EXCEPT SELECT course_id FROM SECTION WHERE semester  =  'Spring' AND YEAR  =  2010
Database: college_2
Question sequence:
What was the largest salary across instructors?
What were all the other distinct salaries?
SQL query sequence:
SELECT max(salary) FROM instructor
SELECT DISTINCT salary FROM instructor WHERE salary  <  (SELECT max(salary) FROM instructor)
Final question: What are the distinct salaries of all instructors who earned less than the maximum salary?
Final SQL: SELECT DISTINCT salary FROM instructor WHERE salary  <  (SELECT max(salary) FROM instructor)
Database: college_2
Question sequence:
What are the distinct ids of instructors teaching in the Spring of 2010?
How many are there?
SQL query sequence:
SELECT DISTINCT ID FROM teaches WHERE semester  =  'Spring' AND YEAR  =  2010
SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester  =  'Spring' AND YEAR  =  2010
Final question: How many instructors teach a course in the Spring of 2010?
Final SQL: SELECT COUNT (DISTINCT ID) FROM teaches WHERE semester  =  'Spring' AND YEAR  =  2010
Database: college_2
Question sequence:
What are the names of departments that have average salaries higher than 42000?
Also, what are their average salaries?
SQL query sequence:
SELECT dept_name FROM instructor GROUP BY dept_name HAVING AVG (salary)  >  42000
SELECT dept_name ,  AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary)  >  42000
Final question: What are the names and average salaries for departments with average salary higher than 42000?
Final SQL: SELECT dept_name ,  AVG (salary) FROM instructor GROUP BY dept_name HAVING AVG (salary)  >  42000
Database: college_2
Question sequence:
What is the lowest salary of instructors in the Biology department?
What are the ids of instructors who earn more than that?
What are their names?
SQL query sequence:
SELECT min(salary) FROM instructor WHERE dept_name  =  'Biology'
SELECT id FROM instructor WHERE salary  >  (SELECT min(salary) FROM instructor WHERE dept_name  =  'Biology')
SELECT name FROM instructor WHERE salary  >  (SELECT min(salary) FROM instructor WHERE dept_name  =  'Biology')
Final question: What are the names of instructors who earn more than at least one instructor from the Biology department?
Final SQL: SELECT name FROM instructor WHERE salary  >  (SELECT min(salary) FROM instructor WHERE dept_name  =  'Biology')
Database: college_2
Question sequence:
What is the highest salary of instructors in the Biology department?
What are the names of instructors who earn more than this?
SQL query sequence:
SELECT max(salary) FROM instructor WHERE dept_name  =  'Biology'
SELECT name FROM instructor WHERE salary  >  (SELECT max(salary) FROM instructor WHERE dept_name  =  'Biology')
Final question: What are the names of all instructors with a higher salary than any of the instructors in the Biology department?
Final SQL: SELECT name FROM instructor WHERE salary  >  (SELECT max(salary) FROM instructor WHERE dept_name  =  'Biology')
Database: college_1
Question sequence:
What are the codes of the accounting department?
Which professors are in that department?
How many are there?
SQL query sequence:
SELECT dept_code FROM department WHERE DEPT_NAME  =  "Accounting"
SELECT * FROM professor AS T1 JOIN department AS T2 ON T1.dept_code  =  T2.dept_code WHERE DEPT_NAME  =  "Accounting"
SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code  =  T2.dept_code WHERE DEPT_NAME  =  "Accounting"
Final question: How many professors are in the accounting dept?
Final SQL: SELECT count(*) FROM professor AS T1 JOIN department AS T2 ON T1.dept_code  =  T2.dept_code WHERE DEPT_NAME  =  "Accounting"
Database: college_1
Question sequence:
What can you tell me about the class with code "ACCT-211"?
How many different professors teach that class?
SQL query sequence:
SELECT * FROM CLASS WHERE CRS_CODE  =  "ACCT-211"
SELECT count(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE  =  "ACCT-211"
Final question: How many professors teach a class with the code ACCT-211?
Final SQL: SELECT count(DISTINCT PROF_NUM) FROM CLASS WHERE CRS_CODE  =  "ACCT-211"
Database: college_1
Question sequence:
What can you tell me about the biology department?
What are the first name of all professors in the department?
What are their last names as well?
SQL query sequence:
SELECT * FROM department WHERE DEPT_NAME  =  "Biology"
SELECT T3.EMP_FNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code  =  T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM  =  T3.EMP_NUM WHERE DEPT_NAME  =  "Biology"
SELECT T3.EMP_FNAME ,  T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code  =  T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM  =  T3.EMP_NUM WHERE DEPT_NAME  =  "Biology"
Final question: What are the first and last name of all biology professors?
Final SQL: SELECT T3.EMP_FNAME ,  T3.EMP_LNAME FROM professor AS T1 JOIN department AS T2 ON T1.dept_code  =  T2.dept_code JOIN employee AS T3 ON T1.EMP_NUM  =  T3.EMP_NUM WHERE DEPT_NAME  =  "Biology"
Database: college_1
Question sequence:
Which professors are in charge of ACCT-211?
What are their first names?
Also, what are their date of births?
SQL query sequence:
SELECT DISTINCT * FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM  =  T2.PROF_NUM WHERE CRS_CODE  =  "ACCT-211"
SELECT DISTINCT T1.EMP_FNAME FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM  =  T2.PROF_NUM WHERE CRS_CODE  =  "ACCT-211"
SELECT DISTINCT T1.EMP_FNAME ,  T1.EMP_DOB FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM  =  T2.PROF_NUM WHERE CRS_CODE  =  "ACCT-211"
Final question: What are the first names and birthdates of the professors in charge of ACCT-211?
Final SQL: SELECT DISTINCT T1.EMP_FNAME ,  T1.EMP_DOB FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM  =  T2.PROF_NUM WHERE CRS_CODE  =  "ACCT-211"
Database: college_1
Question sequence:
Give all details about the professor with the last name Graztevski?
Which classes does he teach? Return the class code.
How many classes does he teach?
SQL query sequence:
SELECT * FROM employee WHERE EMP_LNAME  =  'Graztevski'
SELECT T2.CRS_CODE FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM  =  T2.PROF_NUM WHERE T1.EMP_LNAME  =  'Graztevski'
SELECT count(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM  =  T2.PROF_NUM WHERE T1.EMP_LNAME  =  'Graztevski'
Final question: How many classes does the professor whose last name is Graztevski teach?
Final SQL: SELECT count(*) FROM employee AS T1 JOIN CLASS AS T2 ON T1.EMP_NUM  =  T2.PROF_NUM WHERE T1.EMP_LNAME  =  'Graztevski'
Database: college_1
Question sequence:
Find all info about the accounting department?
What is its school code?
SQL query sequence:
SELECT * FROM department WHERE dept_name  =  "Accounting"
SELECT school_code FROM department WHERE dept_name  =  "Accounting"
Final question: What is the school code of the accounting department?
Final SQL: SELECT school_code FROM department WHERE dept_name  =  "Accounting"
Database: college_1
Question sequence:
How many credits does each course have?
How many does CIS-220 have?
What is its description?
SQL query sequence:
SELECT crs_credit ,  crs_code FROM course GROUP BY crs_code
SELECT crs_credit FROM course WHERE crs_code  =  'CIS-220'
SELECT crs_description FROM course WHERE crs_code  =  'CIS-220'
Final question: What is the description for the CIS-220 and how many credits does it have?
Final SQL: SELECT crs_credit ,  crs_description FROM course WHERE crs_code  =  'CIS-220'
Database: college_1
Question sequence:
List addresses of all departments.
What is one for the history department?
SQL query sequence:
SELECT dept_address FROM department
SELECT dept_address FROM department WHERE dept_name  =  'History'
Final question: Where is the history department?
Final SQL: SELECT dept_address FROM department WHERE dept_name  =  'History'
Database: college_1
Question sequence:
What are the names of departments in the school with the code BUS?
What are different addresses of the school?
How many of them are there?
SQL query sequence:
SELECT DEPT_NAME FROM department WHERE school_code  =  'BUS'
SELECT DISTINCT dept_address FROM department WHERE school_code  =  'BUS'
SELECT count(DISTINCT dept_address) FROM department WHERE school_code  =  'BUS'
Final question: What are the different locations of the school with the code BUS?
Final SQL: SELECT count(DISTINCT dept_address) FROM department WHERE school_code  =  'BUS'
Database: college_1
Question sequence:
How many different shools are there?
How many different addresses does each one have?
SQL query sequence:
SELECT count(DISTINCT school_code) FROM department
SELECT count(DISTINCT dept_address) ,  school_code FROM department GROUP BY school_code
Final question: Count different addresses of each school.
Final SQL: SELECT count(DISTINCT dept_address) ,  school_code FROM department GROUP BY school_code
Database: college_1
Question sequence:
Return all info about all courses.
How many credits is the course QM-261 worth?
WHat is its description?
SQL query sequence:
SELECT * FROM course
SELECT crs_credit FROM course WHERE crs_code  =  'QM-261'
SELECT crs_credit ,  crs_description FROM course WHERE crs_code  =  'QM-261'
Final question: What is the course description and number of credits for QM-261?
Final SQL: SELECT crs_credit ,  crs_description FROM course WHERE crs_code  =  'QM-261'
Database: college_1
Question sequence:
What are the different school codes?
For each one, how many different departments does it have?
SQL query sequence:
SELECT DISTINCT school_code FROM department
SELECT count(DISTINCT dept_name) ,  school_code FROM department GROUP BY school_code
Final question: How many departments are in each school?
Final SQL: SELECT count(DISTINCT dept_name) ,  school_code FROM department GROUP BY school_code
Database: college_1
Question sequence:
What are the different schools?
How many departments does each one of them have?
Find the ones which have less than 5 deparments.
SQL query sequence:
SELECT DISTINCT school_code FROM department
SELECT count(DISTINCT dept_name) ,  school_code FROM department GROUP BY school_code
SELECT count(DISTINCT dept_name) ,  school_code FROM department GROUP BY school_code HAVING count(DISTINCT dept_name)  <  5
Final question: How many different departments are there in each school that has less than 5 apartments?
Final SQL: SELECT count(DISTINCT dept_name) ,  school_code FROM department GROUP BY school_code HAVING count(DISTINCT dept_name)  <  5
Database: college_1
Question sequence:
What are the different course codes?
How many sections exist for each one?
SQL query sequence:
SELECT DISTINCT crs_code FROM CLASS
SELECT count(*) ,  crs_code FROM CLASS GROUP BY crs_code
Final question: How many sections does each course have?
Final SQL: SELECT count(*) ,  crs_code FROM CLASS GROUP BY crs_code