interaction_utterance
sequencelengths 0
6
| interaction_query
sequencelengths 0
6
| final_utterance
stringlengths 19
224
| final_query
stringlengths 22
577
| db_id
stringclasses 140
values |
---|---|---|---|---|
[
"How many students are there?",
"How many courses are there?",
"What is the name of each course and the corresponding number of student enrollment?"
] | [
"SELECT COUNT(*) FROM Students",
"SELECT COUNT(*) FROM Courses",
"SELECT T1.course_name , COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name"
] | What is the name of each course and the corresponding number of student enrollment? | SELECT T1.course_name , COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name | e_learning |
[
"What are the dates of all the tests that have the result \"Fail\"?",
"How about that of all the tests that have the result \"Pass\"?",
"So what are the enrollment dates of all the tests that have the result \"Pass\"?"
] | [
"SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = \"Fail\"",
"SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = \"Pass\"",
"SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = \"Pass\""
] | What are the enrollment dates of all the tests that have result "Pass"? | SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Pass" | e_learning |
[
"How many tests have result \"Fail\"?",
"What are the dates of those tests?",
"What are the completion dates of all the tests that have result \"Fail\"?"
] | [
"SELECT COUNT(*) FROM Student_Tests_Taken WHERE test_result = \"Fail\"",
"SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = \"Fail\"",
"SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = \"Fail\""
] | What are the completion dates of all the tests that have result "Fail"? | SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" | e_learning |
[
"Tell me Karson's registration date.",
"When is his enrollment?",
"When is his completion?"
] | [
"SELECT date_of_registration FROM Students WHERE personal_name = \"Karson\"",
"SELECT T1.date_of_enrolment FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = \"Karson\"",
"SELECT T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = \"Karson\""
] | List the dates of enrollment and completion of the student with personal name "Karson". | SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = "Karson" | e_learning |
[
"Tell me Krystel's date of registration.",
"How about her dates of enrollment and completion?",
"How about the dates of enrollment and completion of the student with family name \"Zieme\" and personal name \"Bernie\"?"
] | [
"SELECT date_of_registration FROM Students WHERE personal_name = \"Krystel\"",
"SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = \"Krystel\"",
"SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = \"Zieme\" AND T2.personal_name = \"Bernie\""
] | List the dates of enrollment and completion of the student with family name "Zieme" and personal name "Bernie". | SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = "Zieme" AND T2.personal_name = "Bernie" | e_learning |
[
"Tell me how many course enrollments there are?",
"Tell me how many there are for the student named Jewel?",
"Tell me the student ID and login name of the student with the most course enrollments."
] | [
"SELECT COUNT(*) FROM Student_Course_Enrolment",
"SELECT COUNT(*) FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = \"Jewel\"",
"SELECT T1.student_id , T2.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1"
] | Find the student ID and login name of the student with the most course enrollments | SELECT T1.student_id , T2.login_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1 | e_learning |
[
"How many students are enrolled in \"AI\"?",
"Tell me the names of the courses that have student enrollment bigger than 5.",
"What are the student ID and personal name of the student with at least two enrollments?"
] | [
"SELECT COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = \"AI\"",
"SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) > 2",
"SELECT T1.student_id , T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2"
] | Find the student ID and personal name of the student with at least two enrollments. | SELECT T1.student_id , T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2 | e_learning |
[
"Tell me all the enrollment information for the student with personal name \"Else\".",
"How about that for the personal name \"Wilson\"?",
"Tell me the student ID and middle name for all the students with at most two enrollments."
] | [
"SELECT * FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = \"Else\"",
"SELECT * FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.personal_name = \"Wilson\"",
"SELECT T1.student_id , T2.middle_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) <= 2"
] | Find the student ID and middle name for all the students with at most two enrollments. | SELECT T1.student_id , T2.middle_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) <= 2 | e_learning |
[
"Tell me the course description of the course named \"database\".",
"Tell me the number of students enrolled in this course.",
"Tell me the personal names of students that not enrolled in any course."
] | [
"SELECT course_description FROM Courses WHERE course_name = \"database\"",
"SELECT T1.course_name , COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name WHERE T1.course_name = \"database\"",
"SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id"
] | Find the personal names of students not enrolled in any course. | SELECT personal_name FROM Students EXCEPT SELECT T1.personal_name FROM Students AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.student_id = T2.student_id | e_learning |
[
"Tell me the course description of the course named art history.",
"Tell me the number of students enrolling this course.",
"How many students did not have any course enrollment?"
] | [
"SELECT course_description FROM Courses WHERE course_name = \"Art history\"",
"SELECT T1.course_name , COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name WHERE T1.course_name = \"Art history\"",
"SELECT count(*) FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment)"
] | How many students did not have any course enrollment? | SELECT count(*) FROM Students WHERE student_id NOT IN (SELECT student_id FROM Student_Course_Enrolment) | e_learning |
[
"Tell me Cary's login name.",
"How about Autumn's login name.",
"Tell me the common login name of course authors and students."
] | [
"SELECT login_name FROM Students WHERE personal_name = \"Cary\"",
"SELECT login_name FROM Students WHERE personal_name = \"Autumn\"",
"SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students"
] | Find the common login name of course authors and students. | SELECT login_name FROM Course_Authors_and_Tutors INTERSECT SELECT login_name FROM Students | e_learning |
[
"List all the information about the club ranks.",
"What is the average number of gold medals?",
"What about silver medals?",
"What about the maximum and minimum number of silver medals?"
] | [
"SELECT * FROM club_rank",
"SELECT avg(Gold) FROM club_rank",
"SELECT avg(Silver) FROM club_rank",
"SELECT max(Silver) , min(Silver) FROM club_rank"
] | What are the maximum and minimum number of silver medals for clubs. | SELECT max(Silver) , min(Silver) FROM club_rank | sports_competition |
[
"What are the club names for each player?",
"How many players are there in each club?",
"Which clubs have players who are the position of \"Right Wing\"."
] | [
"SELECT T1.name, T2.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID",
"SELECT T1.name, count(*) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID group by T1.name",
"SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = \"Right Wing\""
] | Show the names of clubs that have players with position "Right Wing". | SELECT T1.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Position = "Right Wing" | sports_competition |
[
"What are the club names and points for each player?",
"What is the average points for all of them?",
"What about that of the club 'BK Slide'?",
"What about club 'AIB'?"
] | [
"SELECT T1.name,T2.Points,T2.name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID",
"SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID",
"SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = \"BK Slide\"",
"SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = \"AIB\""
] | What is the average points of players from club with name "AIB". | SELECT avg(T2.Points) FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.name = "AIB" | sports_competition |
[
"Show all the positions of the players.",
"How many unique positions are there?",
"How many players are there for each of them?",
"What is the average points of all players?",
"What are the positions of the players with average number of points scored by players of that position bigger than 20?"
] | [
"SELECT POSITION FROM player",
"SELECT count (distinct POSITION) FROM player",
"SELECT POSITION, count (*) FROM player GROUP BY POSITION",
"SELECT avg(Points) FROM player",
"SELECT POSITION FROM player GROUP BY name HAVING avg(Points) >= 20"
] | List the position of players with average number of points scored by players of that position bigger than 20. | SELECT POSITION FROM player GROUP BY name HAVING avg(Points) >= 20 | sports_competition |
[
"How many unique competition types are there?",
"How many competitions are there for each type?",
"Among those results, which one is the most common one?"
] | [
"SELECT count (distinct Competition_type) FROM competition",
"SELECT Competition_type, count(*) FROM competition GROUP BY Competition_type",
"SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1"
] | List the most common type of competition. | SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 1 | sports_competition |
[
"How many unique competition types are there?",
"How many competitions are there for each type?",
"What are the top 3 competition types?",
"What about the ones that have at most five competitions of that type."
] | [
"SELECT count (distinct Competition_type) FROM competition",
"SELECT Competition_type, count(*) FROM competition GROUP BY Competition_type",
"SELECT Competition_type FROM competition GROUP BY Competition_type ORDER BY COUNT(*) DESC LIMIT 3",
"SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5"
] | List the types of competition that have at most five competitions of that type. | SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5 | sports_competition |
[
"What are the club names?",
"How many of them have at least one player?",
"Which ones have no players at all?"
] | [
"SELECT name FROM CLub",
"SELECT count(name) FROM CLub WHERE Club_ID IN (SELECT Club_ID FROM player)",
"SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player)"
] | List the names of clubs that do not have any players. | SELECT name FROM CLub WHERE Club_ID NOT IN (SELECT Club_ID FROM player) | sports_competition |
[
"What is the average value of points?",
"How many players have points less than 20.0?",
"What are the positions of those players?",
"What about the positions of those players who have more than 20 points and less than 10 points."
] | [
"SELECT avg(Points) FROM player",
"SELECT count(*) FROM player WHERE Points < 20",
"SELECT POSITION FROM player WHERE Points < 20",
"SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10"
] | What are the positions with both players having more than 20 points and less than 10 points. | SELECT POSITION FROM player WHERE Points > 20 INTERSECT SELECT POSITION FROM player WHERE Points < 10 | sports_competition |
[
"What are the maximum and mean values of the points?",
"What are the player names of those who have more points than the average?"
] | [
"SELECT max(points), avg(points) FROM player",
"SELECT name FROM player WHERE points > (SELECT avg(points) FROM player)"
] | what are the name of players who get more than the average points. | SELECT name FROM player WHERE points > (SELECT avg(points) FROM player) | sports_competition |
[
"What are the minimum and mean values of the points?",
"What are the player names of those who have fewer points than the average?",
"How many are there?",
"How many players are there whose points are lower than 30?",
"Among those, how many players are there for each position?"
] | [
"SELECT min(points), avg(points) FROM player",
"SELECT name FROM player WHERE points < (SELECT avg(points) FROM player)",
"SELECT count(*) FROM player WHERE points < (SELECT avg(points) FROM player)",
"SELECT count(*) FROM player WHERE points < 30",
"SELECT count(*) , POSITION FROM player WHERE points < 30 GROUP BY POSITION"
] | find the number of players whose points are lower than 30 in each position. | SELECT count(*) , POSITION FROM player WHERE points < 30 GROUP BY POSITION | sports_competition |
[
"How many competitions are there where the competition type is 'Friendly'?",
"What about for the type 'Tournament'?",
"Among those results, how many competitions are there for each country?",
"Which one is the most popular country?"
] | [
"SELECT count(*) FROM competition WHERE competition_type = 'Friendly'",
"SELECT count(*) FROM competition WHERE competition_type = 'Tournament'",
"SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country",
"SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1"
] | which country did participated in the most number of Tournament competitions? | SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1 | sports_competition |
[
"How many competitions are there where the competition type is 'Friendly'?",
"Among those results, how many competitions are there for each country?",
"What about for type 'Tournament'?",
"Which countries held both types of competitions?"
] | [
"SELECT count(*) FROM competition WHERE competition_type = 'Friendly'",
"SELECT country FROM competition WHERE competition_type = 'Friendly' GROUP BY country",
"SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country",
"SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament'"
] | which countries did participated in both Friendly and Tournament type competitions. | SELECT country FROM competition WHERE competition_type = 'Friendly' INTERSECT SELECT country FROM competition WHERE competition_type = 'Tournament' | sports_competition |
[
"Which assets have 2 parts? Show me its id and details.",
"Which assets have less than 2 fault logs? Show me its id and details.",
"Which assets fulfill both of those conditions? Show me asset id and details."
] | [
"SELECT T1.asset_id , T1.asset_details FROM Assets AS T1 JOIN Asset_Parts AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING count(*) = 2",
"SELECT T1.asset_id , T1.asset_details FROM Assets AS T1 JOIN Fault_Log AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING count(*) < 2",
"SELECT T1.asset_id , T1.asset_details FROM Assets AS T1 JOIN Asset_Parts AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING count(*) = 2 INTERSECT SELECT T1.asset_id , T1.asset_details FROM Assets AS T1 JOIN Fault_Log AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING count(*) < 2"
] | Which assets have 2 parts and have less than 2 fault logs? List the asset id and detail. | SELECT T1.asset_id , T1.asset_details FROM Assets AS T1 JOIN Asset_Parts AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING count(*) = 2 INTERSECT SELECT T1.asset_id , T1.asset_details FROM Assets AS T1 JOIN Fault_Log AS T2 ON T1.asset_id = T2.asset_id GROUP BY T1.asset_id HAVING count(*) < 2 | assets_maintenance |
[
"Show me assets each maintenance contract contains.",
"Show me the number of assets and contract id."
] | [
"SELECT * FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id",
"SELECT count(*) , T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id"
] | How many assets does each maintenance contract contain? List the number and the contract id. | SELECT count(*) , T1.maintenance_contract_id FROM Maintenance_Contracts AS T1 JOIN Assets AS T2 ON T1.maintenance_contract_id = T2.maintenance_contract_id GROUP BY T1.maintenance_contract_id | assets_maintenance |
[
"Show me assets supplied by each third party company.",
"How many are there for each third party company? Show me the company id as well."
] | [
"SELECT * FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id",
"SELECT count(*) , T1.company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id"
] | How many assets does each third party company supply? List the count and the company id. | SELECT count(*) , T1.company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id | assets_maintenance |
[
"Which third party companies have at least 2 maintenance engineers? List the id and name of that company.",
"Show me names and ids of third party companies that have at least 2 maintenance contracts as well, along with the previous result."
] | [
"SELECT T1.company_id , T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Engineers AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING count(*) >= 2",
"SELECT T1.company_id , T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Engineers AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING count(*) >= 2 UNION SELECT T3.company_id , T3.company_name FROM Third_Party_Companies AS T3 JOIN Maintenance_Contracts AS T4 ON T3.company_id = T4.maintenance_contract_company_id GROUP BY T3.company_id HAVING count(*) >= 2"
] | Which third party companies have at least 2 maintenance engineers or have at least 2 maintenance contracts? List the company id and name. | SELECT T1.company_id , T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Engineers AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING count(*) >= 2 UNION SELECT T3.company_id , T3.company_name FROM Third_Party_Companies AS T3 JOIN Maintenance_Contracts AS T4 ON T3.company_id = T4.maintenance_contract_company_id GROUP BY T3.company_id HAVING count(*) >= 2 | assets_maintenance |
[
"What is the name and id of the staff who recorded the fault log?",
"Among those staff members, only show the name and id of staff who has not contacted any visiting engineers."
] | [
"SELECT T1.staff_name , T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id",
"SELECT T1.staff_name , T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id EXCEPT SELECT T3.staff_name , T3.staff_id FROM Staff AS T3 JOIN Engineer_Visits AS T4 ON T3.staff_id = T4.contact_staff_id"
] | What is the name and id of the staff who recorded the fault log but has not contacted any visiting engineers? | SELECT T1.staff_name , T1.staff_id FROM Staff AS T1 JOIN Fault_Log AS T2 ON T1.staff_id = T2.recorded_by_staff_id EXCEPT SELECT T3.staff_name , T3.staff_id FROM Staff AS T3 JOIN Engineer_Visits AS T4 ON T3.staff_id = T4.contact_staff_id | assets_maintenance |
[
"Which engineer has visited the least number of times? Show the id, first and last names of that engineer.",
"Do the same for the engineer who has visited the most times."
] | [
"SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY count(*) ASC LIMIT 1",
"SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY count(*) DESC LIMIT 1"
] | Which engineer has visited the most times? Show the engineer id, first name and last name. | SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY count(*) DESC LIMIT 1 | assets_maintenance |
[
"Which parts have less than 2 faults? Show the id and name of that part.",
"Do the same for parts with more than 2 faults."
] | [
"SELECT T1.part_name , T1.part_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_id HAVING count(*) < 2",
"SELECT T1.part_name , T1.part_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_id HAVING count(*) > 2"
] | Which parts have more than 2 faults? Show the part name and id. | SELECT T1.part_name , T1.part_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_id HAVING count(*) > 2 | assets_maintenance |
[
"List all engineers' first and last names.",
"List the details of each engineer and corresponding skill descriptions as well, along with the names."
] | [
"SELECT T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id",
"SELECT T1.first_name , T1.last_name , T1.other_details , T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id"
] | List all every engineer's first name, last name, details and coresponding skill description. | SELECT T1.first_name , T1.last_name , T1.other_details , T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id | assets_maintenance |
[
"Show me all faults of different parts.",
"Give me descriptions of skills required to fix those faults, along with the names of those faults."
] | [
"SELECT fault_short_name FROM Part_Faults",
"SELECT T1.fault_short_name , T3.skill_description FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id"
] | For all the faults of different parts, what are all the decriptions of the skills required to fix them? List the name of the faults and the skill description. | SELECT T1.fault_short_name , T3.skill_description FROM Part_Faults AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.part_fault_id = T2.part_fault_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id | assets_maintenance |
[
"Show me all assets each part can be used in. List the part name and the asset details.",
"How many assets can each part be used in? Show me the count and the part name."
] | [
"SELECT T1.part_name , T3.asset_details FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id JOIN assets AS T3 ON T2.asset_id = T3.asset_id GROUP BY T1.part_name",
"SELECT T1.part_name , count(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name"
] | How many assets can each parts be used in? List the part name and the number. | SELECT T1.part_name , count(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name | assets_maintenance |
[
"What is the lowest number of engineer visits for a single fault log? List the number and log entry id.",
"Do the same for the highest number of engineer visits for a single fault log?"
] | [
"SELECT count(*) , T1.fault_log_entry_id FROM Fault_Log AS T1 JOIN Engineer_Visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) ASC LIMIT 1",
"SELECT count(*) , T1.fault_log_entry_id FROM Fault_Log AS T1 JOIN Engineer_Visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) DESC LIMIT 1"
] | How many engineer visits are required at most for a single fault log? List the number and the log entry id. | SELECT count(*) , T1.fault_log_entry_id FROM Fault_Log AS T1 JOIN Engineer_Visits AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) DESC LIMIT 1 | assets_maintenance |
[
"How many engineers have never visited to maintain the assets?",
"Show me their first and last names."
] | [
"SELECT count(*) FROM Maintenance_Engineers WHERE engineer_id NOT IN (SELECT engineer_id FROM Engineer_Visits)",
"SELECT first_name , last_name FROM Maintenance_Engineers WHERE engineer_id NOT IN (SELECT engineer_id FROM Engineer_Visits)"
] | Which engineers have never visited to maintain the assets? List the engineer first name and last name. | SELECT first_name , last_name FROM Maintenance_Engineers WHERE engineer_id NOT IN (SELECT engineer_id FROM Engineer_Visits) | assets_maintenance |
[
"When was the latest date that an asset was acquired?",
"How about the oldest date?"
] | [
"SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date DESC LIMIT 1",
"SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC LIMIT 1"
] | When was the first asset acquired? | SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC LIMIT 1 | assets_maintenance |
[
"Show me the id and name of a fault that needs the least number of skills to be fixed.",
"How about the fault that requires the most number of skills to fix?"
] | [
"SELECT T1.part_id , T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id = T3.part_fault_id GROUP BY T1.part_id ORDER BY count(*) ASC LIMIT 1",
"SELECT T1.part_id , T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id = T3.part_fault_id GROUP BY T1.part_id ORDER BY count(*) DESC LIMIT 1"
] | Which part fault requires the most number of skills to fix? List part id and name. | SELECT T1.part_id , T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id JOIN Skills_Required_To_Fix AS T3 ON T2.part_fault_id = T3.part_fault_id GROUP BY T1.part_id ORDER BY count(*) DESC LIMIT 1 | assets_maintenance |
[
"Show me the name of each part with the number of faults it has.",
"Show me the name of part with the least number of faults."
] | [
"SELECT T1.part_name, count(*) FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name",
"SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY count(*) ASC LIMIT 1"
] | Which kind of part has the least number of faults? List the part name. | SELECT T1.part_name FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name ORDER BY count(*) ASC LIMIT 1 | assets_maintenance |
[
"Show me all the engineers.",
"Show me id, first and last names of engineers who have visited.",
"Among those, which one made the least number of visits."
] | [
"SELECT * FROM Maintenance_Engineers",
"SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 ON T1.engineer_id = T2.engineer_id GROUP BY T1.engineer_id",
"SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 ON T1.engineer_id = T2.engineer_id GROUP BY T1.engineer_id ORDER BY count(*) ASC LIMIT 1"
] | Among those engineers who have visited, which engineer makes the least number of visits? List the engineer id, first name and last name. | SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 ON T1.engineer_id = T2.engineer_id GROUP BY T1.engineer_id ORDER BY count(*) ASC LIMIT 1 | assets_maintenance |
[
"Show me names of all the staff members.",
"List the first and last names of engineers each staff member has contacted."
] | [
"SELECT staff_name FROM Staff",
"SELECT T1.staff_name , T3.first_name , T3.last_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id"
] | Which staff have contacted which engineers? List the staff name and the engineer first name and last name. | SELECT T1.staff_name , T3.first_name , T3.last_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id | assets_maintenance |
[
"Which fault log included the least number of faulty parts? List the id, description, and record time of that fault log.",
"Show the same for the fault log with most number of faulty parts."
] | [
"SELECT T1.fault_log_entry_id , T1.fault_description , T1.fault_log_entry_datetime FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) ASC LIMIT 1",
"SELECT T1.fault_log_entry_id , T1.fault_description , T1.fault_log_entry_datetime FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) DESC LIMIT 1"
] | Which fault log included the most number of faulty parts? List the fault log id, description and record time. | SELECT T1.fault_log_entry_id , T1.fault_description , T1.fault_log_entry_datetime FROM Fault_Log AS T1 JOIN Fault_Log_Parts AS T2 ON T1.fault_log_entry_id = T2.fault_log_entry_id GROUP BY T1.fault_log_entry_id ORDER BY count(*) DESC LIMIT 1 | assets_maintenance |
[
"Show me id and descriptions of all the skills.",
"For each of those skills, show the number of faults each skill is used to fix.",
"Which skill is used to fix the most number of faults?"
] | [
"SELECT skill_id, skill_description FROM Skills",
"SELECT T1.skill_id , T1.skill_description, count(*) FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id = T2.skill_id GROUP BY T1.skill_id ORDER BY count(*) DESC LIMIT 1",
"SELECT T1.skill_id , T1.skill_description FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id = T2.skill_id GROUP BY T1.skill_id ORDER BY count(*) DESC LIMIT 1"
] | Which skill is used in fixing the most number of faults? List the skill id and description. | SELECT T1.skill_id , T1.skill_description FROM Skills AS T1 JOIN Skills_Required_To_Fix AS T2 ON T1.skill_id = T2.skill_id GROUP BY T1.skill_id ORDER BY count(*) DESC LIMIT 1 | assets_maintenance |
[
"Show chargeable amount for every part.",
"Order them by chargeable amount in ascending order.",
"Show me the id and chargeable amount of the part with the least chargeable amount."
] | [
"SELECT chargeable_amount FROM Parts",
"SELECT chargeable_amount FROM Parts ORDER BY chargeable_amount ASC",
"SELECT part_id , chargeable_amount FROM Parts ORDER BY chargeable_amount ASC LIMIT 1"
] | Which part has the least chargeable amount? List the part id and amount. | SELECT part_id , chargeable_amount FROM Parts ORDER BY chargeable_amount ASC LIMIT 1 | assets_maintenance |
[
"Show me the names of companies that started the five earliest maintenance contracts.",
"Show me the same for the earliest one."
] | [
"SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id ORDER BY T2.contract_start_date ASC LIMIT 5",
"SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id ORDER BY T2.contract_start_date ASC LIMIT 1"
] | Which company started the earliest the maintenance contract? Show the company name. | SELECT T1.company_name FROM Third_Party_Companies AS T1 JOIN Maintenance_Contracts AS T2 ON T1.company_id = T2.maintenance_contract_company_id ORDER BY T2.contract_start_date ASC LIMIT 1 | assets_maintenance |
[
"List gender of each staff.",
"Which gender do most staff members have?"
] | [
"SELECT gender FROM staff",
"SELECT gender FROM staff GROUP BY gender ORDER BY count(*) DESC LIMIT 1"
] | Which gender makes up the majority of the staff? | SELECT gender FROM staff GROUP BY gender ORDER BY count(*) DESC LIMIT 1 | assets_maintenance |
[
"Show me engineers each staff has contacted. List the names of contact staff and engineers.",
"How many engineers did each staff contact? List the count instead of the names of engineers."
] | [
"SELECT T1.staff_name , T3.first_name FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id GROUP BY T1.staff_name",
"SELECT T1.staff_name , count(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name"
] | How many engineers did each staff contact? List both the contact staff name and number of engineers contacted. | SELECT T1.staff_name , count(*) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id GROUP BY T1.staff_name | assets_maintenance |
[
"Show me all about stations.",
"What are the network names?",
"How about the local authorities and services provided by all stations."
] | [
"SELECT * FROM station;",
"SELECT network_name FROM station;",
"SELECT local_authority , services FROM station;"
] | list the local authorities and services provided by all stations. | SELECT local_authority , services FROM station; | station_weather |
[
"Show me the origin of all trains ordered by time early to late.",
"Now show me the train_number for all trains ordered by time early to late.",
"Also provide the train_name for each of the result above."
] | [
"SELECT origin FROM train ORDER BY time;",
"SELECT train_number FROM train ORDER BY TIME;",
"SELECT train_number , name FROM train ORDER BY TIME;"
] | show all train numbers and names ordered by their time from early to late. | SELECT train_number , name FROM train ORDER BY TIME; | station_weather |
[
"What's time for trains going to Mumbai?",
"How about the time and train number for trains going to Chennai?",
"Order the result by time."
] | [
"SELECT time FROM train WHERE destination = 'Mumbai';",
"SELECT TIME , train_number FROM train WHERE destination = 'Chennai';",
"SELECT TIME , train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME;"
] | Give me the times and numbers of all trains that go to Chennai, ordered by time. | SELECT TIME , train_number FROM train WHERE destination = 'Chennai' ORDER BY TIME; | station_weather |
[
"Show me the train names.",
"How many distinct names are there?",
"How many trains have 'Express' in their names?"
] | [
"SELECT name FROM train;",
"SELECT count(DISTINCT name) FROM train;",
"SELECT count(*) FROM train WHERE name LIKE \"%Express%\";"
] | How many trains have 'Express' in their names? | SELECT count(*) FROM train WHERE name LIKE "%Express%"; | station_weather |
[
"How many trains are going from Chennai to Guruvayur?",
"What times are they each going?",
"Find both train number and time."
] | [
"SELECT count(*) FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur';",
"SELECT time FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur';",
"SELECT train_number , time FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur';"
] | Find the number and time of the train that goes from Chennai to Guruvayur. | SELECT train_number , TIME FROM train WHERE origin = 'Chennai' AND destination = 'Guruvayur'; | station_weather |
[
"What are the origins of all trains?",
"Which origin has the most number of trains?",
"Find the number of trains starting from each origin."
] | [
"SELECT origin FROM train;",
"SELECT origin FROM train GROUP BY origin ORDER BY count(*) DESC LIMIT 1;",
"SELECT origin , count(*) FROM train GROUP BY origin;"
] | Find the number of trains starting from each origin. | SELECT origin , count(*) FROM train GROUP BY origin; | station_weather |
[
"Show me the station names.",
"How about the name of trains and the number of stations each runs through?",
"Of these, return the name with the greatest number of stations."
] | [
"SELECT network_name FROM station;",
"SELECT t1.name, count(*) FROM train AS t1 JOIN route AS t2 ON t1.id = t2.train_id GROUP BY t2.train_id;",
"SELECT t1.name FROM train AS t1 JOIN route AS t2 ON t1.id = t2.train_id GROUP BY t2.train_id ORDER BY count(*) DESC LIMIT 1;"
] | Find the name of the train whose route runs through greatest number of stations. | SELECT t1.name FROM train AS t1 JOIN route AS t2 ON t1.id = t2.train_id GROUP BY t2.train_id ORDER BY count(*) DESC LIMIT 1; | station_weather |
[
"Can you list the services for each station?",
"Can you also show the the number of trains for each station?",
"Also include the the station network name."
] | [
"SELECT services FROM station;",
"SELECT count(*) , t1.services FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id;",
"SELECT count(*) , t1.network_name , t1.services FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id;"
] | Find the number of trains for each station, as well as the station network name and services. | SELECT count(*) , t1.network_name , t1.services FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id; | station_weather |
[
"What's the average low temperature of Monday?",
"How about its average high temperature?",
"Show me the average high temperature for each day of week?"
] | [
"SELECT avg(low_temperature) FROM weekly_weather WHERE day_of_week = \"Monday\";",
"SELECT avg(high_temperature) FROM weekly_weather WHERE day_of_week = \"Monday\";",
"SELECT avg(high_temperature) , day_of_week FROM weekly_weather GROUP BY day_of_week;"
] | What is the average high temperature for each day of week? | SELECT avg(high_temperature) , day_of_week FROM weekly_weather GROUP BY day_of_week; | station_weather |
[
"Show me the all about weather for all stations.",
"What's the maximum low temperature and average precipitation for Bushey station?",
"How about for the Amersham station?"
] | [
"SELECT * FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id;",
"SELECT max(t1.low_temperature) , avg(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id WHERE t2.network_name = \"Bushey\";",
"SELECT max(t1.low_temperature) , avg(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id WHERE t2.network_name = \"Amersham\";"
] | Give me the maximum low temperature and average precipitation at the Amersham station. | SELECT max(t1.low_temperature) , avg(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id WHERE t2.network_name = "Amersham"; | station_weather |
[
"Show me the names of trains that run through a station serviced by Greater Anglia.",
"How about stations for local authority Chiltern?",
"For these, also provide the times of each train."
] | [
"SELECT t3.name FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.services = \"Greater Anglia\";",
"SELECT t3.name FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = \"Chiltern\";",
"SELECT t3.name , t3.time FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = \"Chiltern\";"
] | Find names and times of trains that run through stations for the local authority Chiltern. | SELECT t3.name , t3.time FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = "Chiltern"; | station_weather |
[
"Show me the services provided by all stations.",
"How about the number of services?",
"How many distinct ones are there?"
] | [
"SELECT services FROM station;",
"SELECT count(services) FROM station;",
"SELECT count(DISTINCT services) FROM station;"
] | How many different services are provided by all stations? | SELECT count(DISTINCT services) FROM station; | station_weather |
[
"What's the high temperature of each station?",
"What's the id of the station with highest average high temperature?",
"Also show me the local authority of this station."
] | [
"SELECT t1.high_temperature FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id;",
"SELECT t2.id FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id ORDER BY avg(high_temperature) DESC LIMIT 1",
"SELECT t2.id , t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id ORDER BY avg(high_temperature) DESC LIMIT 1"
] | Find the id and local authority of the station with has the highest average high temperature. | SELECT t2.id , t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id ORDER BY avg(high_temperature) DESC LIMIT 1 | station_weather |
[
"List the minimum precipitation of each station.",
"How about the max precipitation? Show station id as well.",
"Find the id and local authority of the station whose maximum precipitation is higher than 50."
] | [
"SELECT min(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id;",
"SELECT t2.id, max(t1.precipitation) FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id;",
"SELECT t2.id , t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id HAVING max(t1.precipitation) > 50;"
] | Find the id and local authority of the station whose maximum precipitation is higher than 50. | SELECT t2.id , t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id HAVING max(t1.precipitation) > 50; | station_weather |
[
"What's average low_temperature per week?",
"How about the average wind speed per week in miles per hour?",
"Show the weekly lowest low temperature and weekly highest wind speed in miles per hour."
] | [
"SELECT avg(low_temperature) FROM weekly_weather;",
"SELECT avg(wind_speed_mph) FROM weekly_weather;",
"SELECT min(low_temperature) , max(wind_speed_mph) FROM weekly_weather;"
] | show the lowest low temperature and highest wind speed in miles per hour. | SELECT min(low_temperature) , max(wind_speed_mph) FROM weekly_weather; | station_weather |
[
"Show information for all book clubs.",
"How many of them?"
] | [
"SELECT * FROM book_club",
"SELECT count(*) FROM book_club"
] | How many book clubs are there? | SELECT count(*) FROM book_club | culture_company |
[
"Show the title for all books.",
"Also show the authors or editors for each of them.",
"How about the results for those published after the year 1989?"
] | [
"SELECT book_title FROM book_club",
"SELECT book_title , author_or_editor FROM book_club",
"SELECT book_title , author_or_editor FROM book_club WHERE YEAR > 1989"
] | show the titles, and authors or editors for all books made after the year 1989. | SELECT book_title , author_or_editor FROM book_club WHERE YEAR > 1989 | culture_company |
[
"Show information for all books.",
"What are the distinct publishers for them?"
] | [
"SELECT * FROM book_club",
"SELECT DISTINCT publisher FROM book_club"
] | Show all distinct publishers for books. | SELECT DISTINCT publisher FROM book_club | culture_company |
[
"Show the titles of all books.",
"Also show the year published and the publisher.",
"Order the results in descending order by year."
] | [
"SELECT book_title FROM book_club",
"SELECT YEAR , book_title , publisher FROM book_club",
"SELECT YEAR , book_title , publisher FROM book_club ORDER BY YEAR DESC"
] | Show the years, book titles, and publishers for all books, in descending order by year. | SELECT YEAR , book_title , publisher FROM book_club ORDER BY YEAR DESC | culture_company |
[
"Show the publisher for all books.",
"Count the number of books published by each of them."
] | [
"SELECT publisher FROM book_club",
"SELECT publisher , count(*) FROM book_club GROUP BY publisher"
] | Show all publishers and the number of books for each publisher. | SELECT publisher , count(*) FROM book_club GROUP BY publisher | culture_company |
[
"Show the publisher for all books.",
"For each of them, how many books are published?",
"Can you order them by the count in descending order?",
"Which one has the most?"
] | [
"SELECT publisher FROM book_club",
"SELECT publisher, count(*) FROM book_club GROUP BY publisher",
"SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC",
"SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1"
] | What is the publisher with most number of books? | SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1 | culture_company |
[
"How many books are there in total?",
"Can you break down the count by the book category?"
] | [
"SELECT count(*) FROM book_club",
"SELECT category , count(*) FROM book_club GROUP BY category"
] | Show all book categories and the number of books in each category. | SELECT category , count(*) FROM book_club GROUP BY category | culture_company |
[
"Show all categories for books.",
"For each of them, count the number of books published after 1989.",
"Which categories have at least two such books?"
] | [
"SELECT category FROM book_club",
"SELECT category, count(*) FROM book_club WHERE YEAR > 1989 GROUP BY category",
"SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING count(*) >= 2"
] | List categories that have at least two books after year 1989. | SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING count(*) >= 2 | culture_company |
[
"Show the publisher for all books.",
"Who published a book in 1989?",
"Among those, who also published a book in 1990?"
] | [
"SELECT publisher FROM book_club",
"SELECT publisher FROM book_club WHERE YEAR = 1989",
"SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990"
] | Show publishers with a book published in 1989 and a book in 1990. | SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990 | culture_company |
[
"Show publishers that published a book in 1989.",
"Show all publishers who do not have such a book."
] | [
"SELECT publisher FROM book_club WHERE YEAR = 1989",
"SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989"
] | Show all publishers which do not have a book in 1989. | SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989 | culture_company |
[
"Show the title and year for all movies.",
"Also show the director for each of them.",
"Order the results by their budgets."
] | [
"SELECT title , YEAR FROM movie",
"SELECT title , YEAR , director FROM movie",
"SELECT title , YEAR , director FROM movie ORDER BY budget_million"
] | Show all movie titles, years, and directors, ordered by budget. | SELECT title , YEAR , director FROM movie ORDER BY budget_million | culture_company |
[
"Show the director for all movies.",
"How many are there?"
] | [
"SELECT director FROM movie",
"SELECT COUNT (DISTINCT director) FROM movie"
] | How many movie directors are there? | SELECT COUNT (DISTINCT director) FROM movie | culture_company |
[
"Show the title and director for all movies.",
"Only show the results for those in the year 2000 or before.",
"Order the results by the worldwide gross in descending order.",
"Which one has the highest?"
] | [
"SELECT title , director FROM movie",
"SELECT title , director FROM movie WHERE YEAR <= 2000",
"SELECT title , director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC",
"SELECT title , director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1"
] | What is the title and director for the movie with highest worldwide gross in the year 2000 or before? | SELECT title , director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1 | culture_company |
[
"Show all director names.",
"Who has a movie in 1999?",
"Who has a movie in 2000?",
"Who has movies in both years?"
] | [
"SELECT director FROM movie",
"SELECT director FROM movie WHERE YEAR = 1999",
"SELECT director FROM movie WHERE YEAR = 2000",
"SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999"
] | Show all director names who have a movie in both year 1999 and 2000. | SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999 | culture_company |
[
"Show all director names.",
"Among them, who has a movie in 1999?",
"Also show those who have a movie in 2000."
] | [
"SELECT director FROM movie",
"SELECT director FROM movie WHERE YEAR = 1999",
"SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000"
] | Show all director names who have a movie in the year 1999 or 2000. | SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000 | culture_company |
[
"Show the budget for all movies.",
"What about the budget for those before 2000?",
"Show their average, maximum, and minimum budget."
] | [
"select budget_million from movie",
"select budget_million from movie WHERE YEAR < 2000",
"SELECT avg(budget_million) , max(budget_million) , min(budget_million) FROM movie WHERE YEAR < 2000"
] | What is the average, maximum, and minimum budget for all movies before 2000. | SELECT avg(budget_million) , max(budget_million) , min(budget_million) FROM movie WHERE YEAR < 2000 | culture_company |
[
"Show all company names.",
"Only show the companies with a book.",
"What about the companies with a book published by Alyson?"
] | [
"SELECT company_name FROM culture_company",
"SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id",
"SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id WHERE T2.publisher = 'Alyson'"
] | List all company names with a book published by Alyson. | SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id WHERE T2.publisher = 'Alyson' | culture_company |
[
"Show all movie titles.",
"Show all movie titles for all companies in China.",
"For those companies, also show all the book titles."
] | [
"SELECT title from movie",
"SELECT T1.title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T2.incorporated_in = 'China'",
"SELECT T1.title , T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id JOIN book_club AS T3 ON T3.book_club_id = T2.book_club_id WHERE T2.incorporated_in = 'China'"
] | Show the movie titles and book titles for all companies in China. | SELECT T1.title , T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id JOIN book_club AS T3 ON T3.book_club_id = T2.book_club_id WHERE T2.incorporated_in = 'China' | culture_company |
[
"Find all female architects.",
"How many are there?"
] | [
"SELECT * FROM architect WHERE gender = 'female'",
"SELECT count(*) FROM architect WHERE gender = 'female'"
] | How many architects are female? | SELECT count(*) FROM architect WHERE gender = 'female' | architecture |
[
"Return all the male architects.",
"What are their names, nationalities and ids?",
"Sort them by name."
] | [
"SELECT * FROM architect WHERE gender = 'male'",
"SELECT name , nationality , id FROM architect WHERE gender = 'male'",
"SELECT name , nationality , id FROM architect WHERE gender = 'male' ORDER BY name"
] | List the name, nationality and id of all male architects ordered by their names lexicographically. | SELECT name , nationality , id FROM architect WHERE gender = 'male' ORDER BY name | architecture |
[
"What is the length in meters of each bridge?",
"Find the maximum length.",
"Show the maximum length in meters of the bridges and the name of the architect that made it."
] | [
"SELECT length_meters FROM bridge",
"SELECT max(length_meters) FROM bridge",
"SELECT max(T1.length_meters) , T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id = T2.id"
] | What is the maximum length in meters for the bridges and what are the architects' names? | SELECT max(T1.length_meters) , T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id = T2.id | architecture |
[
"What is the length in feet of each bridge?",
"Find the average length."
] | [
"SELECT length_feet FROM bridge",
"SELECT avg(length_meters) FROM bridge"
] | What is the average length in feet of the bridges? | SELECT avg(length_feet) FROM bridge | architecture |
[
"What are the names of all the mills?",
"What are the names of all the mills of 'Grondzeiler' type?",
"Also show the years that they were built."
] | [
"SELECT name FROM mill",
"SELECT name FROM mill WHERE TYPE = 'Grondzeiler'",
"SELECT name , built_year FROM mill WHERE TYPE = 'Grondzeiler'"
] | What are the names and year of construction for the mills of 'Grondzeiler' type? | SELECT name , built_year FROM mill WHERE TYPE = 'Grondzeiler' | architecture |
[
"What are the ids of the architects who built a mill?",
"What are all their distinct names and nationalities?"
] | [
"SELECT architect_id FROM mill",
"SELECT DISTINCT T1.name , T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id"
] | What are the distinct names and nationalities of the architects who have ever built a mill? | SELECT DISTINCT T1.name , T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id | architecture |
[
"Show the information for all mills.",
"Which mills are not located in 'Donceel'?",
"What are their names?"
] | [
"SELECT * FROM mill",
"SELECT * FROM mill WHERE LOCATION != 'Donceel'",
"SELECT name FROM mill WHERE LOCATION != 'Donceel'"
] | What are the names of the mills which are not located in 'Donceel'? | SELECT name FROM mill WHERE LOCATION != 'Donceel' | architecture |
[
"Which architects have nationality 'American' or 'Canadian'?",
"Find all mills that are built by these architects.",
"What are the distinct types of these mills?"
] | [
"SELECT * FROM architect WHERE nationality = 'American' OR nationality = 'Canadian'",
"SELECT * FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian'",
"SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian'"
] | What are the distinct types of mills that are built by American or Canadian architects? | SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian' | architecture |
[
"Find the id of the architect who built each bridge.",
"How many bridges did each one build?",
"What are the ids and names of those who built at least 3 bridges ?"
] | [
"SELECT architect_id FROM bridge",
"SELECT count(*) FROM bridge GROUP BY architect_id",
"SELECT T1.id , T1.name FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) >= 3"
] | What are the ids and names of the architects who built at least 3 bridges ? | SELECT T1.id , T1.name FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) >= 3 | architecture |
[
"How many mills did each architect build?",
"Which architect built the most?",
"What are the id, name and nationality of this architect?"
] | [
"SELECT count(*) FROM mill GROUP BY architect_id",
"SELECT * FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1",
"SELECT T1.id , T1.name , T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1"
] | What is the id, name and nationality of the architect who built most mills? | SELECT T1.id , T1.name , T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1 | architecture |
[
"How many bridges did each architect build?",
"What are the ids, names and genders of the architects who built two bridges?",
"How about for the architects who built two bridges or one mill?"
] | [
"SELECT count(*) FROM bridge GROUP BY architect_id",
"SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 2",
"SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 2 UNION SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 1"
] | What are the ids, names and genders of the architects who built two bridges or one mill? | SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 2 UNION SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 1 | architecture |
[
"Show the location of each bridge.",
"What is it for the bridge named 'Kolob Arch'?",
"How about for the bridges named either 'Kolob Arch' or 'Rainbow Bridge'?"
] | [
"SELECT LOCATION FROM bridge",
"SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch'",
"SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge'"
] | What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'? | SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge' | architecture |
[
"What are the names of mills?",
"Which ones contain the french word 'Moulin'?"
] | [
"SELECT name FROM mill",
"SELECT name FROM mill WHERE name LIKE '%Moulin%'"
] | Which of the mill names contains the french word 'Moulin'? | SELECT name FROM mill WHERE name LIKE '%Moulin%' | architecture |
[
"Which bridges have a length above 80 meters?",
"Show all the architects that have built each of these bridges.",
"What are the distinct name of the mills built by these architects?"
] | [
"SELECT * FROM bridge WHERE length_meters > 80",
"SELECT * FROM architect AS t2 JOIN bridge AS T3 ON T3.architect_id = T2.id WHERE T3.length_meters > 80",
"SELECT DISTINCT T1.name FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id JOIN bridge AS T3 ON T3.architect_id = T2.id WHERE T3.length_meters > 80"
] | What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters? | SELECT DISTINCT T1.name FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id JOIN bridge AS T3 ON T3.architect_id = T2.id WHERE T3.length_meters > 80 | architecture |
[
"Count the number of mill types.",
"What is the most common mill type?",
"Also provide the number of mills of this type."
] | [
"SELECT count(*) FROM mill GROUP BY TYPE",
"SELECT TYPE FROM mill GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1",
"SELECT TYPE , count(*) FROM mill GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1"
] | What is the most common mill type, and how many are there? | SELECT TYPE , count(*) FROM mill GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1 | architecture |
[
"Find all mills that were built before year 1850.",
"What are the ids of the architects who built a mill before year 1850?",
"How many other architects are there?"
] | [
"SELECT * FROM mill WHERE built_year < 1850",
"SELECT architect_id FROM mill WHERE built_year < 1850",
"SELECT count(*) FROM architect WHERE id NOT IN ( SELECT architect_id FROM mill WHERE built_year < 1850 )"
] | How many architects haven't built a mill before year 1850? | SELECT count(*) FROM architect WHERE id NOT IN ( SELECT architect_id FROM mill WHERE built_year < 1850 ); | architecture |
[
"What is the maximum enrollment of all schools?",
"What is the total enrollment of these schools?",
"Please also show the average enrollment."
] | [
"SELECT max(enrollment) FROM school",
"SELECT sum(enrollment) FROM school",
"SELECT sum(enrollment) , avg(enrollment) FROM school"
] | What are the total and average enrollment of all schools? | SELECT sum(enrollment) , avg(enrollment) FROM school | school_finance |
[
"How many different mascots are there?",
"What are they?",
"Which of them are from schools with enrollments above the average?"
] | [
"SELECT COUNT(DISTINCT mascot) FROM school",
"SELECT DISTINCT mascot FROM school",
"SELECT mascot FROM school WHERE enrollment > (SELECT avg(enrollment) FROM school)"
] | What are the mascots for schools with enrollments above the average? | SELECT mascot FROM school WHERE enrollment > (SELECT avg(enrollment) FROM school) | school_finance |
[
"What school has the largest enrollment?",
"What is its mascot?",
"What school has the smallest enrollment?"
] | [
"SELECT school_name FROM school ORDER BY enrollment DESC LIMIT 1",
"SELECT mascot FROM school ORDER BY enrollment DESC LIMIT 1",
"SELECT school_name FROM school ORDER BY enrollment LIMIT 1"
] | List the name of the school with the smallest enrollment. | SELECT school_name FROM school ORDER BY enrollment LIMIT 1 | school_finance |
[
"What are the 3 largest enrollments of all schools?",
"What is the largest enrollment?",
"Please also show the average and minimum enrollment"
] | [
"SELECT enrollment FROM school ORDER BY enrollment DESC LIMIT 3",
"SELECT max(enrollment) FROM school",
"SELECT avg(enrollment) , max(enrollment) , min(enrollment) FROM school"
] | Show the average, maximum, minimum enrollment of all schools. | SELECT avg(enrollment) , max(enrollment) , min(enrollment) FROM school | school_finance |
[
"How many different counties are there?",
"How many schools are there in each county?",
"Please also show the total enrollment in each county."
] | [
"SELECT count(DISTINCT county) FROM school",
"SELECT county , count(*) FROM school GROUP BY county",
"SELECT county , count(*) , sum(enrollment) FROM school GROUP BY county"
] | Show each county along with the number of schools and total enrollment in each county. | SELECT county , count(*) , sum(enrollment) FROM school GROUP BY county | school_finance |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.