aherntech/sparc huggingface dataset:
Database: game_1
Question sequence:
What information do you have on the students?
What are their ids?
Which of those are for students who have advisor 1121?
SQL query sequence:
SELECT * FROM Student
SELECT StuID FROM Student
SELECT StuID FROM Student WHERE Advisor  =  1121
Final question: What are the ids of all students who have advisor number 1121?
Final SQL: SELECT StuID FROM Student WHERE Advisor  =  1121
Database: game_1
Question sequence:
List all student information
Which of that information is for students in the major numbered 600?
What are their first names?
SQL query sequence:
SELECT * FROM Student
SELECT * FROM Student WHERE major  =  600
SELECT Fname FROM Student WHERE major  =  600
Final question: What are the first names for all students who are from the major numbered 600?
Final SQL: SELECT Fname FROM Student WHERE Major  =  600
Database: game_1
Question sequence:
What are the different majors?
For each of those, what is the average age?
Also, what is the minimum and maximum for each of those?
SQL query sequence:
SELECT major FROM Student
SELECT  avg(age) FROM Student GROUP BY major
SELECT major ,  avg(age) ,  min(age) ,  max(age) FROM Student GROUP BY major
Final question: What are the average, minimum, and max ages for each of the different majors?
Final SQL: SELECT major ,  avg(age) ,  min(age) ,  max(age) FROM Student GROUP BY major
Database: game_1
Question sequence:
What information do you have on each advisor?
What is the name for each advisor?
Which of those are for advisors who have more than 1 students?
SQL query sequence:
SELECT * FROM Student GROUP BY advisor
SELECT advisor FROM STUDENT GROUP BY advisor
SELECT advisor FROM STUDENT GROUP BY advisor HAVING count(*)  >=  2
Final question: What are the advisors
Final SQL: SELECT advisor FROM Student GROUP BY advisor HAVING count(*)  >=  2
Database: game_1
Question sequence:
What sport does every student play?
What is a list of the different types of sports?
How long is that list?
SQL query sequence:
SELECT sportname FROM Sportsinfo
SELECT DISTINCT sportname FROM Sportsinfo
SELECT count(DISTINCT sportname) FROM Sportsinfo
Final question: How many different types of sports do we offer?
Final SQL: SELECT count(DISTINCT sportname) FROM Sportsinfo
Database: game_1
Question sequence:
What is the student id of every student involved in sports?
Delete any repeats.
How many different student ids are there?
SQL query sequence:
SELECT StuID FROM Sportsinfo
SELECT DISTINCT StuID FROM Sportsinfo
SELECT count(DISTINCT StuID) FROM Sportsinfo
Final question: How many different students are involved in sports?
Final SQL: SELECT count(DISTINCT StuID) FROM Sportsinfo
Database: game_1
Question sequence:
What information is there on all sport players?
Which of those are on scholarship?
What are their student ids?
SQL query sequence:
SELECT * FROM Sportsinfo
SELECT * FROM Sportsinfo WHERE onscholarship  =  'Y'
SELECT StuID FROM Sportsinfo WHERE onscholarship  =  'Y'
Final question: What are the ids for all sporty students who are on scholarship?
Final SQL: SELECT StuID FROM Sportsinfo WHERE onscholarship  =  'Y'
Database: game_1
Question sequence:
What information is there on all students who play sports?
Which subset of this information is for students on scholarships?
What are their last names?
SQL query sequence:
SELECT * FROM Sportsinfo
SELECT * FROM Sportsinfo WHERE onscholarship  =  'Y'
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T1.onscholarship  =  'Y'
Final question: What are the last names for all scholarship students?
Final SQL: SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T1.onscholarship  =  'Y'
Database: game_1
Question sequence:
What sports information do you have?
How many games did each student play?
What is the total number played?
SQL query sequence:
SELECT * FROM Sportsinfo
SELECT gamesplayed FROM Sportsinfo
SELECT sum(gamesplayed) FROM Sportsinfo
Final question: What is the total number of games played?
Final SQL: SELECT sum(gamesplayed) FROM Sportsinfo
Database: game_1
Question sequence:
How many games has each student played?
Which of those refer to football games played by scholarship students?
What is the total number of those games played?
SQL query sequence:
SELECT gamesplayed FROM Sportsinfo
SELECT gamesplayed FROM Sportsinfo WHERE sportname  =  "Football" AND onscholarship  =  'Y'
SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname  =  "Football" AND onscholarship  =  'Y'
Final question: What is the total number of all football games played by scholarship students?
Final SQL: SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname  =  "Football" AND onscholarship  =  'Y'
Database: game_1
Question sequence:
What information do you have on each sport?
How many students play each one?
Also, what are the names of each sport?
SQL query sequence:
SELECT * FROM Sportsinfo GROUP BY sportname
SELECT count(*) FROM Sportsinfo GROUP BY sportname
SELECT sportname ,  count(*) FROM Sportsinfo GROUP BY sportname
Final question: How many students play each sport?
Final SQL: SELECT sportname ,  count(*) FROM Sportsinfo GROUP BY sportname
Database: game_1
Question sequence:
How many sports does each student play?
Also, how many games has each student played?
Also, what are their different student ids?
SQL query sequence:
SELECT count(*) FROM Sportsinfo GROUP BY StuID
SELECT count(*) ,  sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
SELECT StuID ,  count(*) ,  sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
Final question: What are the ids of all students along with how many sports and games did they play?
Final SQL: SELECT StuID ,  count(*) ,  sum(gamesplayed) FROM Sportsinfo GROUP BY StuID
Database: game_1
Question sequence:
What are the student IDs for every student?
Which of those are for students who played more than 10 hours of a week for all sports?
SQL query sequence:
SELECT StuID FROM Sportsinfo GROUP BY StuID
SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek)  >  10
Final question: What are the student IDs for everybody who worked for more than 10 hours per week on all sports?
Final SQL: SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek)  >  10
Database: game_1
Question sequence:
For each student, how many sports do they play?
Order the information in descending order by number of sports played.
What is the first and last name of student who played the most?
SQL query sequence:
SELECT count(*) FROM Sportsinfo GROUP BY StuID
SELECT count(*) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID GROUP BY T1.StuID
SELECT T2.Fname ,  T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
Final question: What is the first and last name of the student who played the most sports?
Final SQL: SELECT T2.Fname ,  T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
Database: game_1
Question sequence:
What is the name of every sport?
Of those, which had students on scholarship?
Which sport has the most of those students?
SQL query sequence:
SELECT sportname FROM Sportsinfo GROUP BY sportname
SELECT sportname FROM Sportsinfo WHERE onscholarship  =  'Y' GROUP BY sportname
SELECT sportname FROM Sportsinfo WHERE onscholarship  =  'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1
Final question: What is the sport with the most scholarship students?
Final SQL: SELECT sportname FROM Sportsinfo WHERE onscholarship  =  'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1
Database: game_1
Question sequence:
What are the student ids of all those who play sports?
What are the ids of all students?
Which ids are in the latter list but not the former?
SQL query sequence:
SELECT StuID FROM Sportsinfo
SELECT StuID FROM Student
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
Final question: What are the ids of all students who don't play sports?
Final SQL: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
Database: game_1
Question sequence:
What are the ids of all students who are in major 600?
What are the student ids for all those on scholarship?
What ids are in both categories?
SQL query sequence:
SELECT StuID FROM Student WHERE major  =  600
SELECT StuID FROM Sportsinfo WHERE onscholarship  =  'Y'
SELECT StuID FROM Student WHERE major  =  600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship  =  'Y'
Final question: What are the student ids for those on scholarship in major number 600?
Final SQL: SELECT StuID FROM Student WHERE major  =  600 INTERSECT SELECT StuID FROM Sportsinfo WHERE onscholarship  =  'Y'
Database: game_1
Question sequence:
What are the ids of all female students?
What are the student ids of all those who play football?
What ids are for both?
SQL query sequence:
SELECT StuID FROM Student WHERE sex  =  'F'
SELECT StuID FROM Sportsinfo WHERE sportname  =  "Football"
SELECT StuID FROM Student WHERE sex  =  'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname  =  "Football"
Final question: What are the ids of all female students who play football?
Final SQL: SELECT StuID FROM Student WHERE sex  =  'F' INTERSECT SELECT StuID FROM Sportsinfo WHERE sportname  =  "Football"
Database: game_1
Question sequence:
What are the ids of all the students?
What are the ids of all those who play football?
What are the ids of those who don't play football?
SQL query sequence:
SELECT StuID FROM Student WHERE sex  =  'M'
SELECT StuID FROM Sportsinfo WHERE sportname  =  "Football"
SELECT StuID FROM Student WHERE sex  =  'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname  =  "Football"
Final question: What are the ids of all male students who do not play football?
Final SQL: SELECT StuID FROM Student WHERE sex  =  'M' EXCEPT SELECT StuID FROM Sportsinfo WHERE sportname  =  "Football"
Database: game_1
Question sequence:
What information on sports do you have for the student named David Shieber?
How many hours per week does he practice in total?
Also, how many games does he play overall?
SQL query sequence:
SELECT * FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T2.Fname  =  "David" AND T2.Lname  =  "Shieber"
SELECT sum(hoursperweek) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T2.Fname  =  "David" AND T2.Lname  =  "Shieber"
SELECT sum(hoursperweek) ,  sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T2.Fname  =  "David" AND T2.Lname  =  "Shieber"
Final question: What is the total number of hours per work and number of games played by David Shieber?
Final SQL: SELECT sum(hoursperweek) ,  sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T2.Fname  =  "David" AND T2.Lname  =  "Shieber"
Database: game_1
Question sequence:
What sports information is there on students under the age of 20?
How many hours per week do they practice in total?
Also, how many games do they play overall?
SQL query sequence:
SELECT * FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T2.age  <  20
SELECT sum(hoursperweek) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T2.age  <  20
SELECT sum(hoursperweek) ,  sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T2.age  <  20
Final question: What is the total number of hours per week and number of games played by students under 20?
Final SQL: SELECT sum(hoursperweek) ,  sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T2.age  <  20
Database: game_1
Question sequence:
What are the student ids of those who play games?
Give me a list of unique ids.
How long is it?
SQL query sequence:
SELECT StuID FROM Plays_games
SELECT DISTINCT StuID FROM Plays_games
SELECT count(DISTINCT StuID) FROM Plays_games
Final question: How many different students play games?
Final SQL: SELECT count(DISTINCT StuID) FROM Plays_games
Database: game_1
Question sequence:
What are all the student ids?
What are the student ids of all who play games?
What are the ids of all those in the first category but not the second?
SQL query sequence:
SELECT StuID FROM Student
SELECT StuID FROM Plays_games
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
Final question: What are the ids of all students who are not video game players?
Final SQL: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Plays_games
Database: game_1
Question sequence:
What are the ids of all students who play sports?
What are the student ids of all those who play games?
What are the ids of those who play sports but don't play games?
SQL query sequence:
SELECT StuID FROM Sportsinfo
SELECT StuID FROM Plays_games
SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
Final question: What are the ids of all students who played video games and sports?
Final SQL: SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games
Database: game_1
Question sequence:
How many hours did each student play for each game?
What is the toal number of hours played for each game?
And what is the id of each game?
SQL query sequence:
SELECT hours_played FROM Plays_games GROUP BY gameid
SELECT sum(hours_played) FROM Plays_games GROUP BY gameid
SELECT gameid ,  sum(hours_played) FROM Plays_games GROUP BY gameid
Final question: What are ids and total number of hours played for each game?
Final SQL: SELECT gameid ,  sum(hours_played) FROM Plays_games GROUP BY gameid
Database: game_1
Question sequence:
For each student id, how many hours did each student play?
How much did they play in total?
Also, what are their student ids?
SQL query sequence:
SELECT hours_played FROM Plays_games GROUP BY Stuid
SELECT sum(hours_played) FROM Plays_games GROUP BY Stuid
SELECT Stuid ,  sum(hours_played) FROM Plays_games GROUP BY Stuid
Final question: What are the ids of all students and number of hours played?
Final SQL: SELECT Stuid ,  sum(hours_played) FROM Plays_games GROUP BY Stuid
Database: game_1
Question sequence:
What is the name of each game from its id?
Order the names by total hours played.
which one is first?
SQL query sequence:
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid  =  T2.gameid GROUP BY T1.gameid
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid  =  T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid  =  T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
Final question: What is the name of the game that has been played the most?
Final SQL: SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid  =  T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
Database: game_1
Question sequence:
SQL query sequence:
Final question: What are the names of all the games that have been played for at least 1000 hours?
Final SQL: SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid  =  T2.gameid GROUP BY T1.gameid HAVING sum(hours_played)  >=  1000
Database: game_1
Question sequence:
SQL query sequence:
Final question: What are the names of all games played by Linda Smith?
Final SQL: SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid  =  T2.gameid JOIN Student AS T3 ON T3.Stuid  =  T1.Stuid WHERE T3.Lname  =  "Smith" AND T3.Fname  =  "Linda"
Database: game_1
Question sequence:
What are the ids of all students who played football or Lacrosse?
What are the first names that correspond to those ids?
Also, what are their last names?
SQL query sequence:
SELECT StuID FROM SportsInfo WHERE SportName  =  "Football" OR SportName  =  "Lacrosse"
SELECT T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T1.SportName  =  "Football" OR T1.SportName  =  "Lacrosse"
SELECT T2.lname ,  T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T1.SportName  =  "Football" OR T1.SportName  =  "Lacrosse"
Final question: What is the first and last name of all students who play Football or Lacrosse?
Final SQL: SELECT T2.lname ,  T2.fname FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID  =  T2.StuID WHERE T1.SportName  =  "Football" OR T1.SportName  =  "Lacrosse"
Database: game_1
Question sequence:
What are the student ids of all who played Football?
Which of those ids are also marked as having played Lacrosse?
What are the first names and ages that correspond to those student ids?
SQL query sequence:
SELECT StuID FROM Sportsinfo WHERE SportName  =  "Football"
SELECT StuID FROM Sportsinfo WHERE SportName  =  "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName  =  "Lacrosse"
SELECT fname ,  age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName  =  "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName  =  "Lacrosse")
Final question: What are the first names and ages of all students who are playing both Football and Lacrosse?
Final SQL: SELECT fname ,  age FROM Student WHERE StuID IN (SELECT StuID FROM Sportsinfo WHERE SportName  =  "Football" INTERSECT SELECT StuID FROM Sportsinfo WHERE SportName  =  "Lacrosse")
Database: college_2
Question sequence:
What are the distinct classroom buildings?
Of those, which have capacity of over 50?
SQL query sequence:
SELECT DISTINCT building FROM classroom
SELECT DISTINCT building FROM classroom WHERE capacity  >  50
Final question: What are the distinct buildings with capacities of greater than 50?
Final SQL: SELECT DISTINCT building FROM classroom WHERE capacity  >  50
Database: college_2
Question sequence:
Which classrooms are not in Lamberton?
How many are there?
SQL query sequence:
SELECT * FROM classroom WHERE building ! =  'Lamberton'
SELECT count(*) FROM classroom WHERE building ! =  'Lamberton'
Final question: How many classrooms are not in Lamberton?
Final SQL: SELECT count(*) FROM classroom WHERE building ! =  'Lamberton'
Database: college_2
Question sequence:
What is the average department budget?
Which departments have a budget higher than average?
What are their names and buildings?
SQL query sequence:
SELECT avg(budget) FROM department
SELECT * FROM department WHERE budget  >  (SELECT avg(budget) FROM department)
SELECT dept_name ,  building FROM department WHERE budget  >  (SELECT avg(budget) FROM department)
Final question: Give the name and building of the departments with greater than average budget.
Final SQL: SELECT dept_name ,  building FROM department WHERE budget  >  (SELECT avg(budget) FROM department)
Database: college_2
Question sequence:
Which classrooms have capacity between 50 and 100?
What are their buildings and room numbers?
SQL query sequence:
SELECT * FROM classroom WHERE capacity BETWEEN 50 AND 100
SELECT building ,  room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
Final question: What are the room numbers and corresponding buildings for classrooms which can seat between 50 to 100 students?
Final SQL: SELECT building ,  room_number FROM classroom WHERE capacity BETWEEN 50 AND 100
Database: college_2
Question sequence:
Order the departments by budget in decreasing order.
Which is has the highest budget?
What is its name and building?
SQL query sequence:
SELECT * FROM department ORDER BY budget DESC
SELECT * FROM department ORDER BY budget DESC LIMIT 1
SELECT dept_name ,  building FROM department ORDER BY budget DESC LIMIT 1
Final question: What is the department name and corresponding building for the department with the greatest budget?
Final SQL: SELECT dept_name ,  building FROM department ORDER BY budget DESC LIMIT 1
Database: college_2
Question sequence:
What are the names of students in the History department?
Which one has the most credits?
SQL query sequence:
SELECT name FROM student WHERE dept_name  =  'History'
SELECT name FROM student WHERE dept_name  =  'History' ORDER BY tot_cred DESC LIMIT 1
Final question: Give the name of the student in the History department with the most credits.
Final SQL: SELECT name FROM student WHERE dept_name  =  'History' ORDER BY tot_cred DESC LIMIT 1
Database: college_2
Question sequence:
What are all the classrooms in Lamberton?
How many are there?
SQL query sequence:
SELECT * FROM classroom WHERE building  =  'Lamberton'
SELECT count(*) FROM classroom WHERE building  =  'Lamberton'
Final question: Count the number of classrooms in Lamberton.
Final SQL: SELECT count(*) FROM classroom WHERE building  =  'Lamberton'
Database: college_2
Question sequence:
What are the student ids of students with advisors?
How many are there?
SQL query sequence:
SELECT DISTINCT s_id FROM advisor
SELECT count(DISTINCT s_id) FROM advisor
Final question: Count the number of students who have advisors.
Final SQL: SELECT count(DISTINCT s_id) FROM advisor
Database: college_2
Question sequence:
What are all the department names of departments that offer courses?
How many are there?
SQL query sequence:
SELECT DISTINCT dept_name FROM course
SELECT count(DISTINCT dept_name) FROM course
Final question: Count the number of departments which offer courses.
Final SQL: SELECT count(DISTINCT dept_name) FROM course
Database: college_2
Question sequence:
What are all the courses in the Physics department?
What are their course ids?
How many are there?
SQL query sequence:
SELECT * FROM course WHERE dept_name  =  'Physics'
SELECT DISTINCT course_id FROM course WHERE dept_name  =  'Physics'
SELECT count(DISTINCT course_id) FROM course WHERE dept_name  =  'Physics'
Final question: Count the number of courses in the Physics department.
Final SQL: SELECT count(DISTINCT course_id) FROM course WHERE dept_name  =  'Physics'
Database: college_2
Question sequence:
Which courses have some prerequisite?
Which ones have two prerequisites among them?
What are their titles?
SQL query sequence:
SELECT * FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id
SELECT * FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  =  2
SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  =  2
Final question: What are the titles for courses with two prerequisites?
Final SQL: SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  =  2
Database: college_2
Question sequence:
Which courses have more than 1 prerequisite?
What title, credit, and department name correspond to these?
SQL query sequence:
SELECT * FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  >  1
SELECT T1.title ,  T1.credits , T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  >  1
Final question: What is the title, credit value, and department name for courses with more than one prerequisite?
Final SQL: SELECT T1.title ,  T1.credits , T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  >  1
Database: college_2
Question sequence:
What are the ids for courses that have some prerequisites?
How many courses do not in the resulting list?
SQL query sequence:
SELECT course_id FROM prereq
SELECT count(*) FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
Final question: Count the number of courses without prerequisites.
Final SQL: SELECT count(*) FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
Database: college_2
Question sequence:
What are the ids for prerequisites?
Which courses do not have prerequisites?
What are their titles?
SQL query sequence:
SELECT course_id FROM prereq
SELECT * FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
Final question: What are the titles of courses without prerequisites?
Final SQL: SELECT title FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq)
Database: college_2
Question sequence:
What are the ids of instructors who have taught a course?
How many are there?
SQL query sequence:
SELECT DISTINCT id FROM teaches
SELECT COUNT (DISTINCT id) FROM teaches
Final question: Count the number of distinct instructors who have taught a course.
Final SQL: SELECT COUNT (DISTINCT id) FROM teaches