aherntech/sparc huggingface dataset:
Database: soccer_2
Question sequence:
What information is there on the player named Charles?
What college is he attending?
What state is that college located in?
SQL query sequence:
SELECT * FROM player WHERE pName  =  'Charles'
SELECT T1.cNAME FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName JOIN player AS T3 ON T2.pID  =  T3.pID WHERE T3.pName  =  'Charles'
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName JOIN player AS T3 ON T2.pID  =  T3.pID WHERE T3.pName  =  'Charles'
Final question: In which state is the college that Charles attends?
Final SQL: SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName JOIN player AS T3 ON T2.pID  =  T3.pID WHERE T3.pName  =  'Charles'
Database: soccer_2
Question sequence:
What are the player ids of all students who made the team?
What is the maximum number of hours they spent practicing?
What was the average?
SQL query sequence:
SELECT T1.pID FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T2.decision  =  'yes'
SELECT max(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T2.decision  =  'yes'
SELECT avg(T1.HS) ,  max(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T2.decision  =  'yes'
Final question: What is the average and maximum number of hours students who made the team practiced?
Final SQL: SELECT avg(T1.HS) ,  max(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T2.decision  =  'yes'
Database: soccer_2
Question sequence:
Which players received a decision of no from tryouts?
How many hours did they practice?
What was the average?
SQL query sequence:
SELECT T1.pNAME FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T2.decision  =  'no'
SELECT T1.pNAME ,  T1.HS FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T2.decision  =  'no'
SELECT avg(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T2.decision  =  'no'
Final question: What is the average number of hours spent practicing for students who got rejected?
Final SQL: SELECT avg(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T2.decision  =  'no'
Database: soccer_2
Question sequence:
What information is there on students who spent more than 1000 hours training?
For each position, how many hours did each student spent training?
What was the maximum time spent for each position?
SQL query sequence:
SELECT * FROM player WHERE HS  >  1000
SELECT T1.HS ,  pPos FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID GROUP BY T2.pPos
SELECT max(T1.HS) ,  pPos FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T1.HS  >  1000 GROUP BY T2.pPos
Final question: For each position, what is the maximum number of  hours for students who spent more than 1000 hours training?
Final SQL: SELECT max(T1.HS) ,  pPos FROM player AS T1 JOIN tryout AS T2 ON T1.pID  =  T2.pID WHERE T1.HS  >  1000 GROUP BY T2.pPos
Database: soccer_2
Question sequence:
What are the player ids of every player whose name starts with D?
Of those, who tried out?
What college did they go to?
SQL query sequence:
SELECT pID FROM player WHERE pName LIKE 'D%'
SELECT T1.pID FROM  tryout AS T1 JOIN player AS T2 ON T1.pID  =  T2.pID WHERE T2.pName LIKE 'D%'
SELECT T1.cName FROM  tryout AS T1 JOIN player AS T2 ON T1.pID  =  T2.pID WHERE T2.pName LIKE 'D%'
Final question: Which colleges does each player with a name that starts with the letter D  who tried out go to?
Final SQL: SELECT T1.cName FROM  tryout AS T1 JOIN player AS T2 ON T1.pID  =  T2.pID WHERE T2.pName LIKE 'D%'
Database: soccer_2
Question sequence:
What can you tell me about the students who made the team?
of those, who tried out for the position of goalie?
What college do they attend?
SQL query sequence:
SELECT * FROM  tryout WHERE decision  =  'yes'
SELECT * FROM tryout WHERE decision  =  'yes' AND pPos  =  'goalie'
SELECT cName FROM  tryout WHERE decision  =  'yes' AND pPos  =  'goalie'
Final question: What college has a student who successfully made the team in the role of a goalie?
Final SQL: SELECT cName FROM  tryout WHERE decision  =  'yes' AND pPos  =  'goalie'
Database: soccer_2
Question sequence:
What are the names of players are from that college?
Of those, who tried out for the team?
SQL query sequence:
SELECT T2.pName FROM tryout AS T1 JOIN player AS T2 ON T1.pID  =  T2.pID WHERE T1.cName  =  (SELECT cName FROM college ORDER BY enr DESC LIMIT 1)
SELECT T2.pName FROM tryout AS T1 JOIN player AS T2 ON T1.pID  =  T2.pID WHERE T1.cName  =  (SELECT cName FROM college ORDER BY enr DESC LIMIT 1)
Final question: What are the names of all tryout participants who are from the largest college?
Final SQL: SELECT T2.pName FROM  tryout AS T1 JOIN player AS T2 ON T1.pID  =  T2.pID WHERE T1.cName  =  (SELECT cName FROM college ORDER BY enr DESC LIMIT 1) S: What IS the largest college?
Database: soccer_2
Question sequence:
What are the names of colleges that have students who made the team?
How many students are enrolled in each of them?
Also, what are the different states in which those colleges reside?
SQL query sequence:
SELECT T1.cName FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.decision  =  'yes'
SELECT T1.enr FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.decision  =  'yes'
SELECT DISTINCT T1.state ,  T1.enr FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.decision  =  'yes'
Final question: How many students are enrolled in colleges that have student accepted during tryouts, and in which states are those colleges?
Final SQL: SELECT DISTINCT T1.state ,  T1.enr FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.decision  =  'yes'
Database: soccer_2
Question sequence:
What are the names of colleges with less than 13,000 students?
Which of those are in AZ?
Combine that with colleges in LA that have more than 15,000 students?
SQL query sequence:
SELECT cName FROM College WHERE enr  <  13000
SELECT cName FROM College WHERE enr  <  13000 AND state = "AZ"
SELECT cName FROM College WHERE enr  <  13000 AND state = "AZ" UNION SELECT cName FROM College WHERE enr  >  15000 AND state = "LA"
Final question: What are the names of colleges in LA that have more than 15,000 students and of colleges in AZ with less than 13,000 students?
Final SQL: SELECT cName FROM College WHERE enr  <  13000 AND state = "AZ" UNION SELECT cName FROM College WHERE enr  >  15000 AND state = "LA"
Database: soccer_2
Question sequence:
What are the names of colleges that have students who tried out for the goalie?
Of those, which also have students who tried out for the position of mid-field?
SQL query sequence:
SELECT cName FROM  tryout WHERE pPos  =  'goalie'
SELECT cName FROM  tryout WHERE pPos  =  'goalie' INTERSECT SELECT cName FROM  tryout WHERE pPos  =  'mid'
Final question: What are the names of all schools that have students trying out for the position of goal and 'mid'-field.
Final SQL: SELECT cName FROM  tryout WHERE pPos  =  'goalie' INTERSECT SELECT cName FROM  tryout WHERE pPos  =  'mid'
Database: soccer_2
Question sequence:
What are the names of colleges that have students who tried out for the goalie?
What states are they located in?
Of those states, which also have colleges where students tried out for mid-field?
SQL query sequence:
SELECT T1.cName FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'goalie'
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'goalie'
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName  WHERE T2.pPos  =  'goalie' INTERSECT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'mid'
Final question: What are the names of the states that have some college students playing in the positions of goalie and mid-field?
Final SQL: SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'goalie' INTERSECT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'mid'
Database: soccer_2
Question sequence:
What are the names of colleges where students tried for the goalie position?
Of those, which also had students that tried out for the mid position?
How many of them are there?
SQL query sequence:
SELECT cName FROM  tryout WHERE pPos  =  'goalie'
SELECT cName FROM  tryout WHERE pPos  =  'goalie' INTERSECT SELECT cName FROM  tryout WHERE pPos  =  'mid'
SELECT COUNT(*) FROM (SELECT cName FROM tryout WHERE pPos  =  'goalie' INTERSECT SELECT cName FROM  tryout WHERE pPos  =  'mid')
Final question: How many schools have students playing in goalie and mid-field positions?
Final SQL: SELECT COUNT(*) FROM (SELECT cName FROM  tryout WHERE pPos  =  'goalie' INTERSECT SELECT cName FROM  tryout WHERE pPos  =  'mid')
Database: soccer_2
Question sequence:
What schools have players that tried out for goalies?
What schools have players that tried out for the mid position?
What are the names of schools that fit into the latter category but not the former?
SQL query sequence:
SELECT cName FROM  tryout WHERE pPos  =  'goalie'
SELECT cName FROM  tryout WHERE pPos  =  'mid'
SELECT cName FROM  tryout WHERE pPos  =  'mid' EXCEPT SELECT cName FROM  tryout WHERE pPos  =  'goalie'
Final question: What are the names of the schools with some players in the mid position but no goalies?
Final SQL: SELECT cName FROM  tryout WHERE pPos  =  'mid' EXCEPT SELECT cName FROM  tryout WHERE pPos  =  'goalie'
Database: soccer_2
Question sequence:
What schools have players that tried out for goalies?
What schools have players that tried out for the mid position?
In which states are the schools that fit into the latter category but not the former?
SQL query sequence:
SELECT cName FROM tryout WHERE pPos  =  'goalie'
SELECT cName FROM tryout WHERE pPos  =  'mid'
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'goalie'
Final question: What are the names of all the states with college students playing in the mid position but no goalies?
Final SQL: SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'goalie'
Database: soccer_2
Question sequence:
What schools have players that tried out for the mid position but not as goalies?
In which states do those schools reside?
How many of them exist?
SQL query sequence:
SELECT cName FROM tryout WHERE pPos  =  'mid' EXCEPT SELECT cName FROM tryout WHERE pPos  =  'goalie'
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'goalie'
SELECT COUNT(*) FROM (SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'goalie')
Final question: What is the count of states with college students playing in the mid position but not as goalies?
Final SQL: SELECT COUNT(*) FROM (SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName  =  T2.cName WHERE T2.pPos  =  'goalie')
Database: soccer_2
Question sequence:
What information is there on colleges in Florida?
What is their maximum enrollment size?
What is the name of every college that is larger than that?
SQL query sequence:
SELECT * FROM college WHERE state  =  'FL'
SELECT max(enr) FROM college WHERE state  =  'FL'
SELECT cName FROM college WHERE enr  >  (SELECT max(enr) FROM college WHERE state  =  'FL')
Final question: What are the names of all colleges with a larger enrollment than the largest college in Florida?
Final SQL: SELECT cName FROM college WHERE enr  >  (SELECT max(enr) FROM college WHERE state  =  'FL')
Database: soccer_2
Question sequence:
What are the names of all colleges with students who tried out for the position of goalie?
What is the number of people enrolled in all the other colleges?
How many is that in total?
SQL query sequence:
SELECT cName FROM tryout WHERE pPos  =  "goalie"
SELECT cNAME ,  enr FROM college WHERE cName NOT IN (SELECT cName FROM tryout WHERE pPos  =  "goalie")
SELECT sum(enr) FROM college WHERE cName NOT IN (SELECT cName FROM tryout WHERE pPos  =  "goalie")
Final question: What is the total number of students enrolled in schools without any goalies?
Final SQL: SELECT sum(enr) FROM college WHERE cName NOT IN (SELECT cName FROM tryout WHERE pPos  =  "goalie")
Database: soccer_2
Question sequence:
What is the average number of students enrolled per college?
What are the states that have larger colleges than that?
How many of them are there?
SQL query sequence:
SELECT avg(enr) FROM college
SELECT DISTINCT state FROM college WHERE enr  >  (SELECT avg(enr) FROM college)
SELECT count(DISTINCT state) FROM college WHERE enr  >  (SELECT avg(enr) FROM college)
Final question: How many states have a college with more students than average?
Final SQL: SELECT count(DISTINCT state) FROM college WHERE enr  >  (SELECT avg(enr) FROM college)
Database: soccer_2
Question sequence:
What is the average number of students per college?
What states have colleges that are smaller than that?
How many of them are there?
SQL query sequence:
SELECT avg(enr) FROM college
SELECT DISTINCT state FROM college WHERE enr  <  (SELECT avg(enr) FROM college)
SELECT count(DISTINCT state) FROM college WHERE enr  <  (SELECT avg(enr) FROM college)
Final question: How many states have smaller colleges than average?
Final SQL: SELECT count(DISTINCT state) FROM college WHERE enr  <  (SELECT avg(enr) FROM college)
Database: scientist_1
Question sequence:
show the name and hours for each project.
how many projects are there?
what is the average number of hours spent on each project?
Find the name of project with the longest duration.
SQL query sequence:
SELECT name, hours FROM projects
SELECT count(*) FROM projects
SELECT avg(hours) FROM projects
SELECT name FROM projects ORDER BY hours DESC LIMIT 1
Final question: Find the name of project that continues for the longest time.
Final SQL: SELECT name FROM projects ORDER BY hours DESC LIMIT 1
Database: scientist_1
Question sequence:
what is average duration of all projects?
what about the maximum and minimum duration?
how many projects have operated longer than the average duration?
what are their names?
SQL query sequence:
SELECT avg(hours) FROM projects
SELECT max(hours), min(hours) FROM projects
SELECT count(*) FROM projects WHERE hours  >  (SELECT avg(hours) FROM projects)
SELECT name FROM projects WHERE hours  >  (SELECT avg(hours) FROM projects)
Final question: List the name of all projects that are operated longer than the average working hours of all projects.
Final SQL: SELECT name FROM projects WHERE hours  >  (SELECT avg(hours) FROM projects)
Database: scientist_1
Question sequence:
find the names of all projects.
how many scientists were assigned to each of them?
which one has the most scientists?
show how much time has already been spent on it as well.
SQL query sequence:
SELECT name FROM projects
SELECT T1.name ,  count(*) FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T2.project
SELECT T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T2.project ORDER BY count(*) DESC LIMIT 1
SELECT T1.name ,  T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T2.project ORDER BY count(*) DESC LIMIT 1
Final question: Find the name and hours of project that has the most number of scientists.
Final SQL: SELECT T1.name ,  T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T2.project ORDER BY count(*) DESC LIMIT 1
Database: scientist_1
Question sequence:
show info of all scientists.
find those scientists whose name contains ‘Smith’.
Find the names of the projects that they are assigned to.
SQL query sequence:
SELECT * FROM scientists
SELECT * FROM scientists WHERE name LIKE '%Smith%'
SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name LIKE '%Smith%'
Final question: Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to.
Final SQL: SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name LIKE '%Smith%'
Database: scientist_1
Question sequence:
show the names of all scientists.
find the ssn of scientists named Michael Rogers and Carol Smith.
what are the names of projects that they are assigned to?
how many hours in total have been spent on these projects?
SQL query sequence:
SELECT name FROM scientists
SELECT ssn FROM scientists WHERE name  =  'Michael Rogers' OR name  =  'Carol Smith'
SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name  =  'Michael Rogers' OR T3.name  =  'Carol Smith'
SELECT sum(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name  =  'Michael Rogers' OR T3.name  =  'Carol Smith'
Final question: Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to.
Final SQL: SELECT sum(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T3.name  =  'Michael Rogers' OR T3.name  =  'Carol Smith'
Database: scientist_1
Question sequence:
what is the number of hours spent on the project named 'Matter of Time’?
Find the names of the scientists who worked on this project.
which of those scientists were also involved in the project named 'A Puzzling Parallax'?
SQL query sequence:
SELECT hours FROM projects WHERE name  =  'A Matter of Time'
SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'A Matter of Time'
SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'A Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'A Puzzling Parallax'
Final question: Find the name of the scientist who worked on both a project named 'A Matter of Time' and a project named 'A Puzzling Parallax'.
Final SQL: SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.name  =  'A Puzzling Parallax'
Database: scientist_1
Question sequence:
how many scientists are in the table?
how many projects are there？
list all of the project names.
Find the number of scientists involved in each of them.
SQL query sequence:
SELECT count(*) FROM scientists
SELECT count(*) FROM projects
SELECT name FROM projects
SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T1.name
Final question: Find the number of scientists involved for each project name.
Final SQL: SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project GROUP BY T1.name
Database: scientist_1
Question sequence:
how many scientists are in the table?
how many of them are assigned to a project?
among them, how many are involved for the projects that require less than 1000 hours. List project names.
how about for the projects that require more than 300 hours?
SQL query sequence:
SELECT count(*) FROM scientists
SELECT count(distinct Scientist) FROM assignedto
SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project WHERE T1.hours  < 1000 GROUP BY T1.name
SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project WHERE T1.hours  >  300 GROUP BY T1.name
Final question: Find the number of scientists involved for the projects that require more than 300 hours.
Final SQL: SELECT count(*) ,  T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code  =  T2.project WHERE T1.hours  >  300 GROUP BY T1.name
Database: scientist_1
Question sequence:
find the names of scientists who are assigned to any projects.
Find the number of projects each of those scientists is working on.
SQL query sequence:
SELECT T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn  =  T2.scientist
SELECT count(*),  T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn  =  T2.scientist GROUP BY T1.name
Final question: Find the number of projects which each scientist is working on and scientist's name.
Final SQL: SELECT count(*),  T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn  =  T2.scientist GROUP BY T1.name
Database: scientist_1
Question sequence:
find the hours spent on the project that has continued for the longest time.
what is the name of this project?
Find the SSN and name of scientists who are assigned to it.
SQL query sequence:
SELECT max(hours) FROM projects
SELECT name FROM projects ORDER BY hours DESC LIMIT 1
SELECT T3.ssn ,  T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.hours  =  (SELECT max(hours) FROM projects)
Final question: Find the SSN and name of scientists who are assigned to the project with the longest hours.
Final SQL: SELECT T3.ssn ,  T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project  =  T2.code JOIN scientists AS T3 ON T1.scientist  =  T3.SSN WHERE T2.hours  =  (SELECT max(hours) FROM projects)
Database: scientist_1
Question sequence:
how many projects are there?
among them, how many are not assigned yet?
what are the names of these projects?
SQL query sequence:
SELECT count(*) FROM Projects
SELECT count(*) FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo)
SELECT Name FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo)
Final question: Select the project names which are not assigned yet.
Final SQL: SELECT Name FROM Projects WHERE Code NOT IN (SELECT Project FROM AssignedTo)
Database: scientist_1
Question sequence:
list the name of all scientists.
which of them are assigned to any project? List their names
how many of those scientists are there?
Find the names of those who are not assigned to a project yet.
SQL query sequence:
SELECT Name FROM scientists
SELECT Name FROM scientists WHERE ssn IN (SELECT scientist FROM AssignedTo)
SELECT count(*) FROM scientists WHERE ssn IN (SELECT scientist FROM AssignedTo)
SELECT Name FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo)
Final question: Find the name of scientists who are not assigned to any project.
Final SQL: SELECT Name FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo)
Database: scientist_1
Question sequence:
find the names of scientists who are assigned to any project.
how about those who are not involved in any project?
count the number of those scientists.
SQL query sequence:
SELECT Name FROM scientists WHERE ssn IN (SELECT scientist FROM AssignedTo)
SELECT name FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo)
SELECT count(*) FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo)
Final question: Find the number of scientists who are not assigned to any project.
Final SQL: SELECT count(*) FROM scientists WHERE ssn NOT IN (SELECT scientist FROM AssignedTo)