aherntech/sparc huggingface dataset:
Database: student_assessment
Question sequence:
Which students attended the course with course id 301?
Count how many did so.
What about the course English?
SQL query sequence:
SELECT student_id FROM student_course_attendance WHERE course_id = 301
SELECT count(*) FROM student_course_attendance WHERE course_id = 301
SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English"
Final question: How many students attend course English?
Final SQL: SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "English"
Database: student_assessment
Question sequence:
What are the dates of attendance for the student with id 141?
With id 171?
What are the courses that this student attends? Give the course names.
How many are there?
SQL query sequence:
SELECT date_of_attendance FROM student_course_attendance WHERE student_id = 141
SELECT date_of_attendance FROM student_course_attendance WHERE student_id = 171
SELECT course_name FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171
SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171
Final question: How many courses do the student whose id is 171 attend?
Final SQL: SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171
Database: student_assessment
Question sequence:
What is the first name of the candidate with login name mkou?
Give the candidate id instead.
Find the same for the candidate with emailstanley.monahan@example.org.
SQL query sequence:
SELECT first_name FROM people WHERE login_name = "mkou"
SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.login_name = "mkou"
SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "stanley.monahan@example.org"
Final question: Find id of the candidate whose email is stanley.monahan@example.org?
Final SQL: SELECT T2.candidate_id FROM people AS T1 JOIN candidates AS T2 ON T1.person_id = T2.candidate_id WHERE T1.email_address = "stanley.monahan@example.org"
Database: student_assessment
Question sequence:
What is the oldest date of assessment of the candidates?
Most recent?
Give the candidate id instead.
SQL query sequence:
SELECT assessment_date FROM candidate_assessments ORDER BY assessment_date ASC LIMIT 1
SELECT assessment_date FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1
SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1
Final question: Find id of the candidate who most recently accessed the course?
Final SQL: SELECT candidate_id FROM candidate_assessments ORDER BY assessment_date DESC LIMIT 1
Database: student_assessment
Question sequence:
Which student registered for the least number of courses? Give the student id.
Most number of courses?
Give the student details.
SQL query sequence:
SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) ASC LIMIT 1
SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY count(*) DESC LIMIT 1
SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
Final question: What are the details of the student who registered the most number of courses?
Final SQL: SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
Database: student_assessment
Question sequence:
How many students registered for each course?
How many courses did each student register for?
Give the student id as well.
SQL query sequence:
SELECT count(*) FROM student_course_registrations GROUP BY course_id
SELECT count(*) FROM student_course_registrations GROUP BY student_id
SELECT T1.student_id ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id
Final question: List the id of students who registered some courses and the number of their registered courses?
Final SQL: SELECT T1.student_id ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id
Database: student_assessment
Question sequence:
How many registered students are there?
How many are there for each course?
Give the course name as well.
SQL query sequence:
SELECT count(DISTINCT student_id) FROM student_course_registrations
SELECT count(*) FROM student_course_registrations GROUP BY course_id
SELECT T3.course_name ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id
Final question: How many registered students does each course have? List course name and the number of their registered students.
Final SQL: SELECT T3.course_name ,  count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id
Database: student_assessment
Question sequence:
Find the qualifications of the candidates with assessment code "Pass"
Give their candidate details instead.
What about with assessment code "Fail"
Find the cell mobile number instead.
SQL query sequence:
SELECT qualification FROM candidate_assessments WHERE asessment_outcome_code = "Pass"
SELECT T1.candidate_details FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id WHERE T2.asessment_outcome_code = "Pass"
SELECT T1.candidate_details FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id WHERE T2.asessment_outcome_code = "Fail"
SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail"
Final question: Find the cell mobile number of the candidates whose assessment code is "Fail"?
Final SQL: SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = "Fail"
Database: student_assessment
Question sequence:
Give the most recently attended course.
What about for the course 301?
Give the student id instead.
SQL query sequence:
SELECT course_id FROM student_course_attendance ORDER BY date_of_attendance DESC LIMIT 1
SELECT course_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1
SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1
Final question: What is the id of the student who most recently attended course is 301?
Final SQL: SELECT student_id FROM student_course_attendance WHERE course_id = 301 ORDER BY date_of_attendance DESC LIMIT 1
Database: student_assessment
Question sequence:
What are the distinct address ids of the people?
Give the same for the students.
Give their cities of addresses too.
SQL query sequence:
SELECT DISTINCT address_id FROM people_addresses
SELECT DISTINCT T1.address_id FROM people_addresses AS T1 JOIN students AS T2 ON T1.person_id = T2.student_id
SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id
Final question: Find distinct cities of address of students?
Final SQL: SELECT DISTINCT T1.city FROM addresses AS T1 JOIN people_addresses AS T2 ON T1.address_id = T2.address_id JOIN students AS T3 ON T2.person_id = T3.student_id
Database: student_assessment
Question sequence:
What are the ids of students who registered courses?
What about for students who also attended courses?
Give the ids for students who did either.
SQL query sequence:
SELECT student_id FROM student_course_registrations
SELECT student_id FROM student_course_registrations INTERSECT SELECT student_id FROM student_course_attendance
SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance
Final question: What are the id of students who registered courses or attended courses?
Final SQL: SELECT student_id FROM student_course_registrations UNION SELECT student_id FROM student_course_attendance
Database: student_assessment
Question sequence:
Find the course ids of the courses registered by the student with id 171.
Find the same for the student with id 121.
Give also the id of courses which are attended by that student.
SQL query sequence:
SELECT course_id FROM student_course_registrations WHERE student_id = 171
SELECT course_id FROM student_course_registrations WHERE student_id = 121
SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121
Final question: Find the id of courses which are registered or attended by student whose id is 121?
Final SQL: SELECT course_id FROM student_course_registrations WHERE student_id = 121 UNION SELECT course_id FROM student_course_attendance WHERE student_id = 121
Database: student_assessment
Question sequence:
How many students registered for courses?
Of them, how many did not attend course 301?
How many did not even attend any course?
Give all the info instead.
SQL query sequence:
SELECT count(*) FROM student_course_registrations
SELECT count(*) FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance WHERE course_id = 301)
SELECT count(*) FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)
SELECT * FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)
Final question: What are all info of students who registered courses but not attended courses?
Final SQL: SELECT * FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)
Database: student_assessment
Question sequence:
Give the registration dates of registrations for the course 305.
How about for the course statistics?
Give the student ids, ordered by the registration date.
SQL query sequence:
SELECT registration_date FROM student_course_registrations WHERE course_id = 305
SELECT T2.registration_date FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics"
SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.registration_date
Final question: List the id of students who registered course statistics in the order of registration date.
Final SQL: SELECT T2.student_id FROM courses AS T1 JOIN student_course_registrations AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.registration_date
Database: wrestler
Question sequence:
What are the names of the wrestlers?
Who has the most number of days held
Least number instead.
SQL query sequence:
SELECT name FROM wrestler
SELECT name FROM wrestler ORDER BY Days_held DESC LIMIT 1
SELECT name FROM wrestler ORDER BY Days_held ASC LIMIT 1
Final question: What is the name of the wrestler with the fewest days held?
Final SQL: SELECT Name FROM wrestler ORDER BY Days_held ASC LIMIT 1
Database: wrestler
Question sequence:
What are the teams in elimination?
Show the respective names of the wrestlers.
Order this by increasing time.
Decreasing instead.
Sort by days held in the same order.
SQL query sequence:
SELECT team FROM elimination
SELECT T2.Name, T1.Team  FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID
SELECT T2.Name, T1.Team  FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T1.Time ASC
SELECT T2.Name, T1.Team  FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY T1.Time DESC
SELECT T2.Name ,  T1.Team FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID  =  T2.Wrestler_ID ORDER BY T2.Days_held DESC
Final question: List the names of wrestlers and the teams in elimination in descending order of days held.
Final SQL: SELECT T2.Name ,  T1.Team FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID  =  T2.Wrestler_ID ORDER BY T2.Days_held DESC
Database: wrestler
Question sequence:
Which wrestler has the largest reign?
Largest days held instead.
List the elimination move of this, not the name.
List the elimination time instead.
SQL query sequence:
SELECT name FROM wrestler ORDER BY Reign DESC LIMIT 1
SELECT name FROM wrestler ORDER BY Days_held DESC LIMIT 1
SELECT T1.Elimination_Move FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID = T2.Wrestler_ID ORDER BY Days_held DESC LIMIT 1
SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID  =  T2.Wrestler_ID ORDER BY T2.Days_held DESC LIMIT 1
Final question: List the time of elimination of the wrestlers with largest days held.
Final SQL: SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID  =  T2.Wrestler_ID ORDER BY T2.Days_held DESC LIMIT 1
Database: wrestler
Question sequence:
What are the names of the wrestlers who have more than 1 reign?
More than 50 days held instead.
Give the times of elimination only.
SQL query sequence:
SELECT name FROM wrestler WHERE reign > 1
SELECT name FROM wrestler WHERE Days_held > 50
SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID  =  T2.Wrestler_ID WHERE T2.Days_held  >  50
Final question: Show times of elimination of wrestlers with days held more than 50.
Final SQL: SELECT T1.Time FROM elimination AS T1 JOIN wrestler AS T2 ON T1.Wrestler_ID  =  T2.Wrestler_ID WHERE T2.Days_held  >  50
Database: wrestler
Question sequence:
What are the teams who have suffered elimination?
Which ones have had only two eliminations?
Which ones have had more than three?
SQL query sequence:
SELECT Team FROM elimination
SELECT Team FROM elimination GROUP BY Team HAVING COUNT(*) = 2
SELECT Team FROM elimination GROUP BY Team HAVING COUNT(*)  >  3
Final question: Show teams that have suffered more than three eliminations.
Final SQL: SELECT Team FROM elimination GROUP BY Team HAVING COUNT(*)  >  3
Database: wrestler
Question sequence:
Show the reigns of the wrestlers.
What is the least common reign?
Opposite?
SQL query sequence:
SELECT Reign FROM wrestler
SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) ASC LIMIT 1
SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) DESC LIMIT 1
Final question: Please show the most common reigns of wrestlers.
Final SQL: SELECT Reign FROM wrestler GROUP BY Reign ORDER BY COUNT(*) DESC LIMIT 1
Database: wrestler
Question sequence:
List the events of the wrestlers.
Locations instead.
Which ones are shared by one wrestler?
More than two instead?
SQL query sequence:
SELECT Event FROM wrestler
SELECT Location FROM wrestler
SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*) = 1
SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*)  >  2
Final question: List the locations that are shared by more than two wrestlers.
Final SQL: SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*)  >  2
Database: wrestler
Question sequence:
Show the names of the wrestlers.
Who has been eliminated?
Who hasn't been?
SQL query sequence:
SELECT Name FROM wrestler
SELECT Name FROM wrestler WHERE Wrestler_ID IN (SELECT Wrestler_ID FROM elimination)
SELECT Name FROM wrestler WHERE Wrestler_ID NOT IN (SELECT Wrestler_ID FROM elimination)
Final question: List the names of wrestlers that have not been eliminated.
Final SQL: SELECT Name FROM wrestler WHERE Wrestler_ID NOT IN (SELECT Wrestler_ID FROM elimination)
Database: wrestler
Question sequence:
Give the teams that have wrestlers eliminated by the move "Go To Sleep"
How about the ones eliminated by "Orton"
Give the ones that were also eliminated by "Benjamin"
SQL query sequence:
SELECT Team FROM Elimination WHERE Elimination_Move = "Go To Sleep"
SELECT Team FROM Elimination WHERE Eliminated_By = "Orton"
SELECT Team FROM Elimination WHERE Eliminated_By  =  "Orton" INTERSECT SELECT Team FROM Elimination WHERE Eliminated_By  =  "Benjamin"
Final question: Show the teams that have both wrestlers eliminated by "Orton" and wrestlers eliminated by "Benjamin".
Final SQL: SELECT Team FROM Elimination WHERE Eliminated_By  =  "Orton" INTERSECT SELECT Team FROM Elimination WHERE Eliminated_By  =  "Benjamin"
Database: local_govt_and_lot
Question sequence:
How many residents are there total?
How many different properties are there?
Show the property id and count of residents for the property with the most residents.
Show this data for each property.
SQL query sequence:
SELECT count(*) FROM residents
SELECT count(DISTINCT property_id) FROM properties
SELECT T1.property_id, count(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id  =  T2.property_id GROUP BY T1.property_id ORDER BY count(*) DESC LIMIT 1
SELECT T1.property_id ,  count(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id  =  T2.property_id GROUP BY T1.property_id
Final question: How many residents does each property have? List property id and resident count.
Final SQL: SELECT T1.property_id ,  count(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id  =  T2.property_id GROUP BY T1.property_id
Database: local_govt_and_lot
Question sequence:
What is the id of the parent organization to the 'Robel-Schulist Group'?
What is the detail of this organization id?
What are the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'?
SQL query sequence:
SELECT parent_organization_id FROM organizations WHERE organization_details = 'Robel-Schulist Group'
SELECT organization_details FROM organizations WHERE organization_id = (SELECT parent_organization_id FROM organizations WHERE organization_details = 'Robel-Schulist Group')
SELECT DISTINCT T1.service_type_code FROM services AS T1 JOIN organizations AS T2 ON T1.organization_id  =  T2.organization_id WHERE T2.organization_details  =  'Denesik and Sons Party'
Final question: What is the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'?
Final SQL: SELECT DISTINCT T1.service_type_code FROM services AS T1 JOIN organizations AS T2 ON T1.organization_id  =  T2.organization_id WHERE T2.organization_details  =  'Denesik and Sons Party'
Database: local_govt_and_lot
Question sequence:
How many residential services were requested?
How about for each resident?
Also show the other details for each resident.
Order the previous table in descending order of the number of requests.
SQL query sequence:
SELECT count(*) FROM residents_services
SELECT t1.resident_id , count(*) FROM residents AS t1 JOIN residents_services AS t2 ON t1.resident_id = t2.resident_id GROUP BY t1.resident_id
SELECT t1.resident_id , t1.other_details , count(*) FROM residents AS t1 JOIN residents_services AS t2 ON t1.resident_id = t2.resident_id GROUP BY t1.resident_id
SELECT t1.resident_id , t1.other_details , count(*) FROM residents AS t1 JOIN residents_services AS t2 ON t1.resident_id = t2.resident_id GROUP BY t1.resident_id ORDER BY count(*) DESC
Final question: How many services has each resident requested? List the resident id, details, and the count in descending order of the count.
Final SQL: SELECT t1.resident_id ,  t1.other_details ,  count(*) FROM residents AS t1 JOIN residents_services AS t2 ON t1.resident_id  =  t2.resident_id GROUP BY t1.resident_id ORDER BY count(*) DESC
Database: local_govt_and_lot
Question sequence:
Show the ID numbers for all the different services that are available.
How many times has a resident service of the type 'Moving Out' been provided?
Which services have not been provided, if any?
What is the most number of times any particular service was provided?
What service was it? Show the service_id and service_details.
SQL query sequence:
SELECT DISTINCT service_id FROM services
SELECT count(*) FROM services AS t1 JOIN residents_services AS t2 ON t1.service_id = t2.service_id WHERE service_type_code = 'Moving Out'
SELECT count(*) FROM services WHERE service_id NOT IN (SELECT DISTINCT t1.service_id FROM services AS t1 JOIN residents_services AS T2 ON t1.service_id = t2.service_id)
SELECT count(*) FROM Services AS T1 JOIN Residents_Services AS T2 ON T1.service_id  =  T2.service_id GROUP BY T1.service_id ORDER BY count(*) DESC LIMIT 1
SELECT T1.service_id ,  T1.service_details ,  count(*) FROM Services AS T1 JOIN Residents_Services AS T2 ON T1.service_id  =  T2.service_id GROUP BY T1.service_id ORDER BY count(*) DESC LIMIT 1
Final question: What is the maximum number that a certain service is provided? List the service id, details and number.
Final SQL: SELECT T1.service_id ,  T1.service_details ,  count(*) FROM Services AS T1 JOIN Residents_Services AS T2 ON T1.service_id  =  T2.service_id GROUP BY T1.service_id ORDER BY count(*) DESC LIMIT 1
Database: local_govt_and_lot
Question sequence:
Show the customer id numbers for those who have events.
How about those with at least 3?
Also show customer details.
SQL query sequence:
SELECT t1.customer_id FROM customers AS t1 JOIN customer_events AS t2 ON t1.customer_id = t2.customer_id
SELECT t1.customer_id FROM Customers AS t1 JOIN Customer_Events AS t2 ON t1.customer_id  =  t2.customer_id GROUP BY t1.customer_id HAVING count(*)  >=  3
SELECT t1.customer_id , t1.customer_details FROM Customers AS t1 JOIN Customer_Events AS t2 ON t1.customer_id  =  t2.customer_id GROUP BY t1.customer_id HAVING count(*)  >=  3
Final question: What are the id and details of the customers who have at least 3 events?
Final SQL: SELECT T1.customer_id ,  T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id HAVING count(*)  >=  3
Database: local_govt_and_lot
Question sequence:
Show any customer event id numbers that have corresponding notes.
How many appear have more than 5 notes?
How about between 1 and 3 notes? Also show property id.
SQL query sequence:
SELECT t1.customer_event_id FROM customer_events AS t1 JOIN customer_event_notes AS t2 ON t1.customer_event_id = t2.customer_event_id
SELECT t1.customer_event_id FROM customer_events AS t1 JOIN customer_event_notes AS t2 ON t1.customer_event_id = t2.customer_event_id GROUP BY t1.customer_event_id HAVING count(*) > 5
SELECT T1.Customer_Event_ID  ,  T1.property_id FROM Customer_Events AS T1 JOIN Customer_Event_Notes AS T2 ON T1.Customer_Event_ID  =  T2.Customer_Event_ID GROUP BY T1.customer_event_id HAVING count(*) BETWEEN 1 AND 3
Final question: Which events have the number of notes between one and three? List the event id and the property id.
Final SQL: SELECT T1.Customer_Event_ID  ,  T1.property_id FROM Customer_Events AS T1 JOIN Customer_Event_Notes AS T2 ON T1.Customer_Event_ID  =  T2.Customer_Event_ID GROUP BY T1.customer_event_id HAVING count(*) BETWEEN 1 AND 3