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 different cities are there?",
"find the number of students living in each city.",
"also find the average age of students living in each city."
] | [
"SELECT count(distinct city_code) FROM student",
"SELECT count(*), city_code FROM student GROUP BY city_code",
"SELECT count(*) , avg(age) , city_code FROM student GROUP BY city_code"
] | Find the number and average age of students living in each city. | SELECT count(*) , avg(age) , city_code FROM student GROUP BY city_code | dorm_1 |
[
"find the number of students living in each city.",
"how many of them are male (with sex M)?",
"Include their average age as well."
] | [
"SELECT count(*), city_code FROM student GROUP BY city_code",
"SELECT count(*), city_code FROM student WHERE sex = 'M' GROUP BY city_code",
"SELECT count(*) , avg(age) , city_code FROM student WHERE sex = 'M' GROUP BY city_code"
] | Find the average age and number of male students (with sex M) from each city. | SELECT count(*) , avg(age) , city_code FROM student WHERE sex = 'M' GROUP BY city_code | dorm_1 |
[
"Find the number of students living in each city.",
"just show the results of cities that have more than one student living in it."
] | [
"SELECT count(*), city_code FROM student GROUP BY city_code",
"SELECT count(*) , city_code FROM student GROUP BY city_code HAVING count(*) > 1"
] | Find the number of students for the cities where have more than one student. | SELECT count(*) , city_code FROM student GROUP BY city_code HAVING count(*) > 1 | dorm_1 |
[
"list all of the different majors.",
"which major has the fewest students?",
"what is the most popular major?",
"how many students are not this major?",
"show their first and last names."
] | [
"SELECT distinct major FROM student",
"SELECT major FROM student GROUP BY major ORDER BY count(*) LIMIT 1",
"SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1",
"SELECT count(*) FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1)",
"SELECT fname , lname FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1)"
] | Find the first and last name of students who are not in the largest major. | SELECT fname , lname FROM student WHERE major != (SELECT major FROM student GROUP BY major ORDER BY count(*) DESC LIMIT 1) | dorm_1 |
[
"what is the average age for each gender?",
"find the number of students whose age is older than the average age of these two groups."
] | [
"SELECT avg(age) , sex FROM student GROUP BY sex",
"SELECT count(*) , sex FROM student WHERE age > (SELECT avg(age) FROM student) GROUP BY sex"
] | Find the number of students whose age is older than the average age for each gender. | SELECT count(*) , sex FROM student WHERE age > (SELECT avg(age) FROM student) GROUP BY sex | dorm_1 |
[
"what are the names of all of the dorms?",
"how many students are living in each dorm? Group by names of dorms.",
"find the average age of students living in each dorm."
] | [
"SELECT dorm_name FROM dorm",
"SELECT count(*), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name",
"SELECT avg(T1.age) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name"
] | Find the average age of students living in each dorm and the name of dorm. | SELECT avg(T1.age) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name | dorm_1 |
[
"find the names of dorms that can accommodate more than 100 students.",
"what is the average capacity of these dorms?",
"Find the number of amenities for each of these dorms."
] | [
"SELECT dorm_name FROM dorm WHERE student_capacity > 100",
"SELECT avg(student_capacity) FROM dorm WHERE student_capacity > 100",
"SELECT count(*) , T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid"
] | Find the number of amenities for each of the dorms that can accommodate more than 100 students. | SELECT count(*) , T1.dormid FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid WHERE T1.student_capacity > 100 GROUP BY T1.dormid | dorm_1 |
[
"what are the names of all dorms?",
"how many students are living in each dorm? Group by names of dorms.",
"how many students are older than 20 years old in each dorm?"
] | [
"SELECT dorm_name FROM dorm",
"SELECT count(*), T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name",
"SELECT count(*) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.age > 20 GROUP BY T3.dorm_name"
] | Find the number of students who is older than 20 in each dorm. | SELECT count(*) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T1.age > 20 GROUP BY T3.dorm_name | dorm_1 |
[
"how many students are living in Smith Hall?",
"show their last names and room numbers.",
"what are their first names?"
] | [
"SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall'",
"SELECT T1.lname, T2.room_number FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall'",
"SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall'"
] | Find the first name of students who are living in the Smith Hall. | SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' | dorm_1 |
[
"show the name and capacity of all dorms.",
"find the name of the dorm with the largest capacity.",
"how many students are living in there?",
"what is the average age of these students?"
] | [
"SELECT dorm_name, student_capacity FROM dorm",
"SELECT dorm_name FROM dorm ORDER BY student_capacity DESC LIMIT 1",
"SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT max(student_capacity) FROM dorm)",
"SELECT avg(T1.age) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT max(student_capacity) FROM dorm)"
] | Find the average age of students who are living in the dorm with the largest capacity. | SELECT avg(T1.age) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT max(student_capacity) FROM dorm) | dorm_1 |
[
"list the names of all male dorms (with gender M).",
"how many are there?",
"Find the total number of students living in these dorms."
] | [
"SELECT dorm_name FROM dorm WHERE gender = 'M'",
"SELECT count(*) FROM dorm WHERE gender = 'M'",
"SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.gender = 'M'"
] | Find the total number of students living in the male dorm (with gender M). | SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.gender = 'M' | dorm_1 |
[
"what is the capacity of Smith Hall dorm?",
"how many students are living in there?",
"how many of them are female?"
] | [
"SELECT student_capacity FROM dorm WHERE dorm_name = 'Smith Hall'",
"SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall'",
"SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.sex = 'F'"
] | Find the number of female students (with F sex) living in Smith Hall | SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall' AND T1.sex = 'F' | dorm_1 |
[
"how many students are living in Smith Hall dorm?",
"Find the number of amenities it has.",
"what are these amenities?"
] | [
"SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall'",
"SELECT count(*) FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall'",
"SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall'"
] | Find the name of amenities Smith Hall dorm have. | SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' | dorm_1 |
[
"What are the amenities in Smith Hall?",
"order the results by amenity names."
] | [
"SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall'",
"SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name"
] | Find the name of amenities Smith Hall dorm have. ordered the results by amenity names. | SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T1.dorm_name = 'Smith Hall' ORDER BY T3.amenity_name | dorm_1 |
[
"show the names of all different amenities.",
"find the total number of each amenity in all of the dorms.",
"which one is the most common amenity used in all dorms? List its name."
] | [
"SELECT amenity_name FROM dorm_amenity",
"SELECT count(*), T2.amenid FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid",
"SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY count(*) DESC LIMIT 1"
] | Find the name of amenity that is the most common in all dorms. | SELECT T1.amenity_name FROM dorm_amenity AS T1 JOIN has_amenity AS T2 ON T1.amenid = T2.amenid GROUP BY T2.amenid ORDER BY count(*) DESC LIMIT 1 | dorm_1 |
[
"what is the id of the dorm that has the most amenities?",
"what is its name?",
"how many students are living in that dorm?",
"find their first names."
] | [
"SELECT T3.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY count(*) DESC LIMIT 1",
"SELECT T3.dorm_name FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY count(*) DESC LIMIT 1",
"SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY count(*) DESC LIMIT 1)",
"SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY count(*) DESC LIMIT 1)"
] | Find the first name of students who are living in the dorm that has most number of amenities. | SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T2.dormid FROM dorm AS T3 JOIN has_amenity AS T4 ON T3.dormid = T4.dormid JOIN dorm_amenity AS T5 ON T4.amenid = T5.amenid GROUP BY T3.dormid ORDER BY count(*) DESC LIMIT 1) | dorm_1 |
[
"find the number of amenities in each dorm.",
"which dorm has the fewest amenities? List its name.",
"what is its capacity?"
] | [
"SELECT T1.dormid , count(*) FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid",
"SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY count(*) LIMIT 1",
"SELECT T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY count(*) LIMIT 1"
] | Find the name and capacity of the dorm with least number of amenities. | SELECT T1.dorm_name , T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY count(*) LIMIT 1 | dorm_1 |
[
"how many dorms have a TV Lounge?",
"what are their names?",
"what are the names of dorms that do not have it?"
] | [
"SELECT count(*) FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge'",
"SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge'",
"SELECT dorm_name FROM dorm EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge'"
] | Find the name of dorms that do not have amenity TV Lounge. | SELECT dorm_name FROM dorm EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge' | dorm_1 |
[
"how many dorms have a TV Lounge?",
"what is the total capacity of these dorms?",
"how many students are living in these dorms?",
"list their first and last names."
] | [
"SELECT COUNT(*) FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge'",
"SELECT sum(T1.student_capacity) FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge'",
"SELECT count(*) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge')",
"SELECT T1.fname , T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge')"
] | Find the first and last name of students who are living in the dorms that have amenity TV Lounge. | SELECT T1.fname , T1.lname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') | dorm_1 |
[
"Find the names of dorms that do not have a TV Lounge.",
"Find the first name and age of students living in these dorms."
] | [
"SELECT dorm_name FROM dorm EXCEPT SELECT T1.dorm_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid WHERE T3.amenity_name = 'TV Lounge'",
"SELECT T1.fname , T1.age FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid NOT IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge')"
] | Find the first name and age of students who are living in the dorms that do not have amenity TV Lounge. | SELECT T1.fname , T1.age FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid WHERE T2.dormid NOT IN (SELECT T3.dormid FROM has_amenity AS T3 JOIN dorm_amenity AS T4 ON T3.amenid = T4.amenid WHERE T4.amenity_name = 'TV Lounge') | dorm_1 |
[
"Show me all about documents.",
"What document types are there?",
"How about document status codes?"
] | [
"SELECT * FROM documents",
"SELECT document_type_code FROM Ref_Document_Types;",
"SELECT document_status_code FROM Ref_Document_Status;"
] | What document status codes do we have? | SELECT document_status_code FROM Ref_Document_Status; | cre_Doc_Control_Systems |
[
"How many document status codes there?",
"What are they?",
"What is the description of document status code 'working'?"
] | [
"SELECT count(document_status_code) FROM Ref_Document_Status;",
"SELECT document_status_code FROM Ref_Document_Status;",
"SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = \"working\";"
] | What is the description of document status code 'working'? | SELECT document_status_description FROM Ref_Document_Status WHERE document_status_code = "working"; | cre_Doc_Control_Systems |
[
"Show me all about document types.",
"Show me the descriptions of document types.",
"Now, show the document type codes."
] | [
"SELECT * FROM Ref_Document_Types;",
"SELECT document_type_description FROM Ref_Document_Types;",
"SELECT document_type_code FROM Ref_Document_Types;"
] | What document type codes do we have? | SELECT document_type_code FROM Ref_Document_Types; | cre_Doc_Control_Systems |
[
"Show me the shipping agent code of documents?",
"How about the document type code?",
"Among those, what is the description of document type 'Paper'?"
] | [
"SELECT shipping_agent_code FROM Ref_Shipping_Agents;",
"SELECT document_type_code FROM Ref_Document_Types;",
"SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = \"Paper\";"
] | What is the description of document type 'Paper'? | SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = "Paper"; | cre_Doc_Control_Systems |
[
"What are the shipping agents' codes?",
"How about their descriptions?",
"Show me their names instead."
] | [
"SELECT shipping_agent_code FROM Ref_Shipping_Agents;",
"SELECT shipping_agent_description FROM Ref_Shipping_Agents;",
"SELECT shipping_agent_name FROM Ref_Shipping_Agents;"
] | What are the shipping agent names? | SELECT shipping_agent_name FROM Ref_Shipping_Agents; | cre_Doc_Control_Systems |
[
"Show me the the shipping agent code of shipping agent Fedex.",
"How about the shipping agent description of shipping agent UPS?",
"What is the shipping agent code of this shipping agent?"
] | [
"SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = \"Fedex\";",
"SELECT shipping_agent_description FROM Ref_Shipping_Agents WHERE shipping_agent_name = \"UPS\";",
"SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = \"UPS\";"
] | What is the shipping agent code of shipping agent UPS? | SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = "UPS"; | cre_Doc_Control_Systems |
[
"Show me all the descriptions for each role?",
"Now show all the role codes."
] | [
"SELECT role_description FROM ROLES;",
"SELECT role_code FROM ROLES;"
] | What are all role codes? | SELECT role_code FROM ROLES; | cre_Doc_Control_Systems |
[
"How many employees have role code ED?",
"What is the description for this role code?"
] | [
"SELECT count(*) FROM Employees WHERE role_code = \"ED\";",
"SELECT role_description FROM ROLES WHERE role_code = \"ED\";"
] | What is the description of role code ED? | SELECT role_description FROM ROLES WHERE role_code = "ED"; | cre_Doc_Control_Systems |
[
"What are the employees' names?",
"How many are there?"
] | [
"SELECT employee_name FROM Employees;",
"SELECT count(*) FROM Employees;"
] | How many employees do we have? | SELECT count(*) FROM Employees; | cre_Doc_Control_Systems |
[
"Show me the names of the employee.",
"What is the role code of the employee named Koby?",
"How about his role description?"
] | [
"SELECT employee_name FROM Employees;",
"SELECT T1.role_code FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = \"Koby\";",
"SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = \"Koby\";"
] | What is the role of the employee named Koby? | SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = "Koby"; | cre_Doc_Control_Systems |
[
"Show me all information about the documents.",
"List document ids and receipt dates of all documents"
] | [
"SELECT * FROM Documents;",
"SELECT document_id , receipt_date FROM Documents;"
] | List all document ids and receipt dates of documents. | SELECT document_id , receipt_date FROM Documents; | cre_Doc_Control_Systems |
[
"What are the role codes?",
"How about their corresponding role_description?",
"List role description, role code and number of employees of each role?"
] | [
"SELECT role_code FROM ROLES;",
"SELECT role_code, role_description FROM ROLES;",
"SELECT T1.role_description , T2.role_code , count(*) FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code;"
] | How many employees does each role have? List role description, id and number of employees. | SELECT T1.role_description , T2.role_code , count(*) FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code; | cre_Doc_Control_Systems |
[
"What are the employees' id?",
"Which of those ids correspond to roles with more than 2 employees? Show in conjunction to the ids.",
"How about more than 1 employee? Now only show the role description and number of employee ids."
] | [
"SELECT employee_id FROM Employees;",
"SELECT Roles.role_description, Employees.employee_id FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING count(Employees.employee_id) > 2;",
"SELECT Roles.role_description , count(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING count(Employees.employee_id) > 1;"
] | List roles that have more than one employee. List the role description and number of employees. | SELECT Roles.role_description , count(Employees.employee_id) FROM ROLES JOIN Employees ON Employees.role_code = Roles.role_code GROUP BY Employees.role_code HAVING count(Employees.employee_id) > 1; | cre_Doc_Control_Systems |
[
"Show me the document with id 2.",
"What about the document status code of document with id 1?",
"What is the document status description for this document?"
] | [
"SELECT * FROM Documents WHERE document_id = 2;",
"SELECT Ref_Document_Status.document_status_code FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1;",
"SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1;"
] | What is the document status description of the document with id 1? | SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 1; | cre_Doc_Control_Systems |
[
"Show me all the information about the documents.",
"List all the documents with status code working?",
"How about the status code done?",
"How many are there?"
] | [
"SELECT * FROM Documents",
"SELECT * FROM Documents WHERE document_status_code = \"working\";",
"SELECT * FROM Documents WHERE document_status_code = \"done\";",
"SELECT count(*) FROM Documents WHERE document_status_code = \"done\";"
] | How many documents have the status code done? | SELECT count(*) FROM Documents WHERE document_status_code = "done"; | cre_Doc_Control_Systems |
[
"Show me document with id 1.",
"What about the document status description of document with id 2?",
"What is the document status code of this document?"
] | [
"SELECT * FROM Documents WHERE document_id = 1;",
"SELECT Ref_Document_Status.document_status_description FROM Ref_Document_Status JOIN Documents ON Documents.document_status_code = Ref_Document_Status.document_status_code WHERE Documents.document_id = 2;",
"SELECT document_type_code FROM Documents WHERE document_id = 2;"
] | List the document type code for the document with the id 2. | SELECT document_type_code FROM Documents WHERE document_id = 2; | cre_Doc_Control_Systems |
[
"How many documents are there?",
"Show me ones with status code done.",
"List the document ids for any documents with the status code done and the type code paper."
] | [
"SELECT count(*) FROM Documents;",
"SELECT * FROM Documents WHERE document_status_code = \"done\"",
"SELECT document_id FROM Documents WHERE document_status_code = \"done\" AND document_type_code = \"Paper\";"
] | List the document ids for any documents with the status code done and the type code paper. | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper"; | cre_Doc_Control_Systems |
[
"What are the shipping agents' names?",
"Show all the documents with shipping agent named USPS?",
"What is the name of the shipping agent of the document with id 2?"
] | [
"SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents;",
"SELECT * FROM documents AS T1 JOIN Ref_Shipping_Agents AS T2 ON T1.shipping_agent_code = T2.shipping_agent_code WHERE T2.shipping_agent_name = \"USPS\";",
"SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2;"
] | What is the name of the shipping agent of the document with id 2? | SELECT Ref_Shipping_Agents.shipping_agent_name FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Documents.document_id = 2; | cre_Doc_Control_Systems |
[
"How many documents are there?",
"How many documents were shipped by Fedex?",
"How about USPS?"
] | [
"SELECT count(*) FROM Documents;",
"SELECT count(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = \"Fedex\";",
"SELECT count(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = \"USPS\";"
] | How many documents were shipped by USPS? | SELECT count(*) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS"; | cre_Doc_Control_Systems |
[
"What's the number of documents each shipping agent shipped?",
"Which agent shipped the least number of documents?",
"How about the most number of documents?"
] | [
"SELECT Ref_Shipping_Agents.shipping_agent_name , count(Documents.document_id) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code;",
"SELECT Ref_Shipping_Agents.shipping_agent_name , count(Documents.document_id) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code ORDER BY count(Documents.document_id) ASC LIMIT 1;",
"SELECT Ref_Shipping_Agents.shipping_agent_name , count(Documents.document_id) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code ORDER BY count(Documents.document_id) DESC LIMIT 1;"
] | Which shipping agent shipped the most documents? List the shipping agent name and the number of documents. | SELECT Ref_Shipping_Agents.shipping_agent_name , count(Documents.document_id) FROM Ref_Shipping_Agents JOIN Documents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code GROUP BY Ref_Shipping_Agents.shipping_agent_code ORDER BY count(Documents.document_id) DESC LIMIT 1; | cre_Doc_Control_Systems |
[
"Show me the receipt number of the documents?",
"How about receipt date?",
"Show me that for document with id 2?",
"How about for document with id 3?"
] | [
"SELECT receipt_number FROM Documents;",
"SELECT receipt_date FROM Documents",
"SELECT receipt_date FROM Documents WHERE document_id = 3;",
"SELECT receipt_date FROM Documents WHERE document_id = 3;"
] | What is the receipt date of the document with id 3? | SELECT receipt_date FROM Documents WHERE document_id = 3; | cre_Doc_Control_Systems |
[
"Show me the receipt_date of document with id 4?",
"What's its mailing date?",
"What address did it mail to?"
] | [
"SELECT receipt_date FROM Documents WHERE document_id = 4;",
"SELECT Documents_Mailed.mailing_date FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4;",
"SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4;"
] | What address was the document with id 4 mailed to? | SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4; | cre_Doc_Control_Systems |
[
"Show me document with id 7.",
"Where did it mail to?",
"How about its mailing date?"
] | [
"SELECT * FROM Documents;",
"SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 7;",
"SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7;"
] | What is the mail date of the document with id 7? | SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7; | cre_Doc_Control_Systems |
[
"Show me document ids of documents with status working.",
"How about documents with the status done and type Paper?",
"Which of those were not shipped by agent named USPS?"
] | [
"SELECT document_id FROM Documents WHERE document_status_code = \"working\";",
"SELECT document_id FROM Documents WHERE document_status_code = \"done\" AND document_type_code = \"Paper\";",
"SELECT document_id FROM Documents WHERE document_status_code = \"done\" AND document_type_code = \"Paper\" EXCEPT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = \"USPS\";"
] | List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS. | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper" EXCEPT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS"; | cre_Doc_Control_Systems |
[
"What are document types of document with status done?",
"Show me the document id of those whose document status is done and document type is Paper.",
"Which of those are shipped by agent named USPS?"
] | [
"SELECT document_type_code FROM Documents WHERE document_status_code = \"done\";",
"SELECT document_id FROM Documents WHERE document_status_code = \"done\" AND document_type_code = \"Paper\";",
"SELECT document_id FROM Documents WHERE document_status_code = \"done\" AND document_type_code = \"Paper\" INTERSECT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = \"USPS\";"
] | List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS. | SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper" INTERSECT SELECT document_id FROM Documents JOIN Ref_Shipping_Agents ON Documents.shipping_agent_code = Ref_Shipping_Agents.shipping_agent_code WHERE Ref_Shipping_Agents.shipping_agent_name = "USPS"; | cre_Doc_Control_Systems |
[
"Show me all about the documents.",
"Only list document with id 7.",
"What are its draft details?"
] | [
"SELECT * FROM Documents;",
"SELECT * FROM Documents WHERE document_id = 7;",
"SELECT draft_details FROM Document_Drafts WHERE document_id = 7;"
] | What is draft detail of the document with id 7? | SELECT draft_details FROM Document_Drafts WHERE document_id = 7; | cre_Doc_Control_Systems |
[
"Show me everything about draft copies.",
"What's the draft number of document with id 2?",
"How many draft copies does it have?"
] | [
"SELECT * FROM Draft_Copies;",
"SELECT draft_number FROM Draft_Copies WHERE document_id = 2;",
"SELECT count(*) FROM Draft_Copies WHERE document_id = 2;"
] | How many draft copies does the document with id 2 have? | SELECT count(*) FROM Draft_Copies WHERE document_id = 2; | cre_Doc_Control_Systems |
[
"What's draft number of the documents?",
"How about the draft copies? Show me how many draft copies each document has?",
"Which of the result has the most draft copies?"
] | [
"SELECT draft_number FROM Draft_Copies;",
"SELECT document_id , count(copy_number) FROM Draft_Copies GROUP BY document_id;",
"SELECT document_id , count(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY count(copy_number) DESC LIMIT 1;"
] | Which document has the most draft copies? List its document id and number of draft copies. | SELECT document_id , count(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY count(copy_number) DESC LIMIT 1; | cre_Doc_Control_Systems |
[
"How many draft copies does each document have? List the id of documents.",
"Which one has the maximum number of draft copies?",
"How about ones with more than 1 draft copies?"
] | [
"SELECT document_id , count(*) FROM Draft_Copies GROUP BY document_id;",
"SELECT document_id , count(*) FROM Draft_Copies GROUP BY document_id ORDER BY draft_number DESC LIMIT 1;",
"SELECT document_id , count(*) FROM Draft_Copies GROUP BY document_id HAVING count(*) > 1;"
] | Which documents have more than 1 draft copies? List document id and number of draft copies. | SELECT document_id , count(*) FROM Draft_Copies GROUP BY document_id HAVING count(*) > 1; | cre_Doc_Control_Systems |
[
"Show me all about the document with id 1.",
"What about role codes of the employees who appeared in the circulation history of it?",
"What about these employees' names?"
] | [
"SELECT * FROM Documents WHERE document_id = 1;",
"SELECT Employees.role_code FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1;",
"SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1;"
] | List all employees in the circulation history of the document with id 1. List the employee's name. | SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1; | cre_Doc_Control_Systems |
[
"For each employee, list the number of documents which showed up in the circulation history.",
"Who showed up the most times?",
"What about the names of the employees who have not showed up in any circulation history of documents."
] | [
"SELECT Employees.employee_name, count(Circulation_History.document_id) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Employees.employee_id;",
"SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Employees.employee_id ORDER BY count(Circulation_History.document_id) DESC LIMIT 1;",
"SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id"
] | List the employees who have not showed up in any circulation history of documents. List the employee's name. | SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id | cre_Doc_Control_Systems |
[
"Show me about the Circulation History.",
"Which employee has showed up in the least Circulation History documents?",
"How about the most circulation history documents? Show the number of circulation history documents as well."
] | [
"SELECT * FROM Circulation_History",
"SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id , Circulation_History.draft_number , Circulation_History.copy_number ORDER BY count(*) ASC LIMIT 1;",
"SELECT Employees.employee_name , count(*) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id , Circulation_History.draft_number , Circulation_History.copy_number ORDER BY count(*) DESC LIMIT 1;"
] | Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies. | SELECT Employees.employee_name , count(*) FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id GROUP BY Circulation_History.document_id , Circulation_History.draft_number , Circulation_History.copy_number ORDER BY count(*) DESC LIMIT 1; | cre_Doc_Control_Systems |
[
"Show all the address information.",
"How about those in country USA?",
"How many of them are there?"
] | [
"SELECT * FROM addresses",
"SELECT * FROM addresses WHERE country = 'USA'",
"SELECT count(*) FROM addresses WHERE country = 'USA'"
] | How many addresses are there in country USA? | SELECT count(*) FROM addresses WHERE country = 'USA' | customers_and_products_contacts |
[
"Show all cities in the addresses.",
"Only show unique names."
] | [
"SELECT city FROM addresses",
"SELECT DISTINCT city FROM addresses"
] | Show all distinct cities in the address record. | SELECT DISTINCT city FROM addresses | customers_and_products_contacts |
[
"Show the state for each address.",
"Also show the number of addresses in each of them."
] | [
"SELECT state_province_county from addresses",
"SELECT state_province_county , count(*) FROM addresses GROUP BY state_province_county"
] | Show each state and the number of addresses in each state. | SELECT state_province_county , count(*) FROM addresses GROUP BY state_province_county | customers_and_products_contacts |
[
"Show the ids of all customers.",
"What about those who have address information?",
"Show the names of those who don't have it.",
"Also show their phone numbers."
] | [
"SELECT customer_id FROM customers",
"SELECT customer_id FROM customer_address_history",
"SELECT customer_name FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM customer_address_history)",
"SELECT customer_name , customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM customer_address_history)"
] | Show names and phones of customers who do not have address information. | SELECT customer_name , customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM customer_address_history) | customers_and_products_contacts |
[
"Show the names of all customers.",
"Also show the number of orders each of them has.",
"Sort the names in descending order of the number of orders.",
"Who has the most?"
] | [
"SELECT customer_name FROM customers",
"SELECT T1.customer_name, count(*) FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id",
"SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC",
"SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1"
] | Show the name of the customer who has the most orders. | SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1 | customers_and_products_contacts |
[
"Show the product type code for all products.",
"For each of them, count the number of products.",
"Which of them have at least two products?"
] | [
"SELECT product_type_code FROM products",
"SELECT product_type_code, count(*) FROM products GROUP BY product_type_code",
"SELECT product_type_code FROM products GROUP BY product_type_code HAVING count(*) >= 2"
] | Show the product type codes which have at least two products. | SELECT product_type_code FROM products GROUP BY product_type_code HAVING count(*) >= 2 | customers_and_products_contacts |
[
"Show the names of all customers.",
"Who has an order in completed status?",
"Who has an order in part status?",
"Who has both?"
] | [
"SELECT customer_name FROM customers",
"SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed'",
"SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part'",
"SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part'"
] | Show the names of customers who have both an order in completed status and an order in part status. | SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part' | customers_and_products_contacts |
[
"Show the name for all customers.",
"Also show their phone number and payment method code.",
"Sort the results in descending order of customer number."
] | [
"SELECT customer_name FROM customers",
"SELECT customer_name , customer_phone , payment_method_code FROM customers",
"SELECT customer_name , customer_phone , payment_method_code FROM customers ORDER BY customer_number DESC"
] | Show the name, phone, and payment method code for all customers in descending order of customer number. | SELECT customer_name , customer_phone , payment_method_code FROM customers ORDER BY customer_number DESC | customers_and_products_contacts |
[
"Show the product name for all products.",
"Show the product name and all the order quantities for each product.",
"For each of those products, what is the total order quantity?"
] | [
"SELECT product_name from products",
"SELECT T1.product_name , T2.order_quantity FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id",
"SELECT T1.product_name , sum(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id"
] | Show the product name and total order quantity for each product. | SELECT T1.product_name , sum(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id | customers_and_products_contacts |
[
"Show the price for all products.",
"What is the minimum, maximum, and average of them?"
] | [
"SELECT product_price FROM products",
"SELECT min(product_price) , max(product_price) , avg(product_price) FROM products"
] | Show the minimum, maximum, average price for all products. | SELECT min(product_price) , max(product_price) , avg(product_price) FROM products | customers_and_products_contacts |
[
"What is the average price for prodcuts?",
"Show product information for products more expensive than the average.",
"How many such products are there?"
] | [
"SELECT avg(product_price) FROM products",
"SELECT * FROM products WHERE product_price > (SELECT avg(product_price) FROM products)",
"SELECT count(*) FROM products WHERE product_price > (SELECT avg(product_price) FROM products)"
] | How many products have a price higher than the average? | SELECT count(*) FROM products WHERE product_price > (SELECT avg(product_price) FROM products) | customers_and_products_contacts |
[
"Show the date from and date to for each customer address history.",
"For each of those records, also show the customer name.",
"For each of those, also show the customer address city."
] | [
"SELECT date_from , date_to FROM customer_address_history",
"SELECT T2.customer_name , T1.date_from , T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id",
"SELECT T2.customer_name , T3.city , T1.date_from , T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id JOIN addresses AS T3 ON T1.address_id = T3.address_id"
] | Show the customer name, customer address city, date from, and date to for each customer address history. | SELECT T2.customer_name , T3.city , T1.date_from , T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id JOIN addresses AS T3 ON T1.address_id = T3.address_id | customers_and_products_contacts |
[
"Show the names of all customers.",
"Count the number of orders each of them has made.",
"For each of them, how many of their orders use Credit Card payment method?",
"Show the names of those who have more than 2 such orders."
] | [
"SELECT customer_name FROM customers",
"SELECT T1.customer_name, count(*) FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id",
"SELECT T1.customer_name, count(*) FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id",
"SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id HAVING count(*) > 2"
] | Show the names of customers who use Credit Card payment method and have more than 2 orders. | SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id HAVING count(*) > 2 | customers_and_products_contacts |
[
"Show the names of all customers.",
"Also show their phone numbers.",
"For each of them, what is the total product quantity of their orders?",
"Sort the results in descending order of the quantity.",
"What are the name and phone number of the customer with the most?"
] | [
"select customer_name from customers",
"select customer_name, customer_phone from customers",
"SELECT T1.customer_name , T1.customer_phone, sum(T3.order_quantity) FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id",
"SELECT T1.customer_name , T1.customer_phone, sum(T3.order_quantity) FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY sum(T3.order_quantity) DESC",
"SELECT T1.customer_name , T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY sum(T3.order_quantity) DESC LIMIT 1"
] | What are the name and phone of the customer with the most ordered product quantity? | SELECT T1.customer_name , T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY sum(T3.order_quantity) DESC LIMIT 1 | customers_and_products_contacts |
[
"Show me the last names of all teachers.",
"Show me the student grade in each classroom.",
"Which classrooms do fifth grade students have?",
"Show me the teachers who teach in any of those classrooms."
] | [
"SELECT lastname FROM teachers",
"SELECT distinct classroom,grade FROM list",
"SELECT distinct classroom FROM list WHERE Grade = 5",
"SELECT DISTINCT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 5"
] | Find the last names of the teachers that teach fifth grade. | SELECT DISTINCT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 5 | student_1 |
[
"Show me the first names of all teachers.",
"Show me the student grade in each classroom.",
"Which classrooms do first grade students have?",
"Show me the teachers who teach in any of those classrooms."
] | [
"SELECT firstname FROM teachers",
"SELECT distinct classroom,grade FROM list",
"SELECT distinct classroom FROM list WHERE Grade = 1",
"SELECT DISTINCT T2.firstname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 1"
] | Find the first names of the teachers that teach first grade. | SELECT DISTINCT T2.firstname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 1 | student_1 |
[
"Show me the name of all teachers in record.",
"Which classrooms does OTHA MOYER teach in?",
"Show me the name of students who are in those classrooms."
] | [
"SELECT firstname, lastname FROM teachers",
"SELECT classroom FROM teachers where firstname = \"OTHA\" AND lastname = \"MOYER\"",
"SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"OTHA\" AND T2.lastname = \"MOYER\""
] | Find all students taught by OTHA MOYER. Output the first and last names of the students. | SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER" | student_1 |
[
"Show me the name of all teachers in record.",
"Which classrooms does MARROTTE KIRK teach in?",
"Show me the name of students who are in those classrooms."
] | [
"SELECT firstname, lastname FROM teachers",
"SELECT classroom FROM teachers where firstname = \"MARROTTE\" AND lastname = \"KIRK\"",
"SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"MARROTTE\" AND T2.lastname = \"KIRK\""
] | Find all students taught by MARROTTE KIRK. Output first and last names of students. | SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "MARROTTE" AND T2.lastname = "KIRK" | student_1 |
[
"How many students are there in the file?",
"Give me the classroom EVELINA BROMLEY is in.",
"Show me the name of teachers that teach in that classroom."
] | [
"SELECT COUNT(*) FROM list",
"SELECT Classroom FROM list WHERE firstname = \"EVELINA\" AND lastname = \"BROMLEY\"",
"SELECT T2.firstname , T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = \"EVELINA\" AND T1.lastname = \"BROMLEY\""
] | Find the first and last name of all the teachers that teach EVELINA BROMLEY. | SELECT T2.firstname , T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "EVELINA" AND T1.lastname = "BROMLEY" | student_1 |
[
"How many students are there in the file?",
"Give me the classroom GELL TAMI is in.",
"Show me the last name of teachers that teach in that classroom."
] | [
"SELECT COUNT(*) FROM list",
"SELECT Classroom FROM list WHERE firstname = \"EVELINA\" AND lastname = \"BROMLEY\"",
"SELECT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = \"GELL\" AND T1.lastname = \"TAMI\""
] | Find the last names of all the teachers that teach GELL TAMI. | SELECT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "GELL" AND T1.lastname = "TAMI" | student_1 |
[
"Show me the name of all teachers in record.",
"Which classrooms does LORIA ONDERSMA teach in?",
"How many students study in those classrooms?"
] | [
"SELECT firstname, lastname FROM teachers",
"SELECT classroom FROM teachers WHERE firstname = \"LORIA\" AND lastname = \"ONDERSMA\"",
"SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"LORIA\" AND T2.lastname = \"ONDERSMA\""
] | How many students does LORIA ONDERSMA teaches? | SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "LORIA" AND T2.lastname = "ONDERSMA" | student_1 |
[
"Show me the name of all teachers in record.",
"Which classrooms does KAWA GORDON teach in?",
"How many students study in those classrooms?"
] | [
"SELECT firstname, lastname FROM teachers",
"SELECT classroom FROM teachers WHERE firstname = \"KAWA\" AND lastname = \"GORDON\"",
"SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"KAWA\" AND T2.lastname = \"GORDON\""
] | How many students does KAWA GORDON teaches? | SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "KAWA" AND T2.lastname = "GORDON" | student_1 |
[
"Show me the name of all teachers in record.",
"Which classrooms does TARRING LEIA teach in?",
"How many students study in those classrooms?"
] | [
"SELECT firstname, lastname FROM teachers",
"SELECT classroom FROM teachers WHERE firstname = \"TARRING\" AND lastname = \"LEIA\"",
"SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"TARRING\" AND T2.lastname = \"LEIA\""
] | Find the number of students taught by TARRING LEIA. | SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "TARRING" AND T2.lastname = "LEIA" | student_1 |
[
"How many teachers are there in record?",
"What classrooms is CHRISSY NABOZNY in?",
"How many are they?"
] | [
"SELECT count(*) FROM teachers",
"SELECT classroom FROM list WHERE firstname = \"CHRISSY\" AND lastname = \"NABOZNY\"",
"SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = \"CHRISSY\" AND T1.lastname = \"NABOZNY\""
] | How many teachers does the student named CHRISSY NABOZNY have? | SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "CHRISSY" AND T1.lastname = "NABOZNY" | student_1 |
[
"How many teachers are there in record?",
"What classrooms is MADLOCK RAY in?",
"How many are they?"
] | [
"SELECT count(*) FROM teachers",
"SELECT classroom FROM list WHERE firstname = \"CHRISSY\" AND lastname = \"NABOZNY\"",
"SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = \"MADLOCK\" AND T1.lastname = \"RAY\""
] | How many teachers does the student named MADLOCK RAY have? | SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "MADLOCK" AND T1.lastname = "RAY" | student_1 |
[
"How many teachers are there?",
"Show me the classroom of OTHA MOYER.",
"What about classrooms other than that?",
"Give me the name of all first-grade students who are in any of those classrooms."
] | [
"SELECT COUNT(*) FROM teachers",
"SELECT classroom FROM teachers WHERE firstname = \"OTHA\" AND lastname = \"MOYER\"",
"SELECT distinct classroom FROM list WHERE classroom not in SELECT classroom FROM teachers WHERE firstname = \"OTHA\" AND lastname = \"MOYER\"",
"SELECT DISTINCT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"OTHA\" AND T2.lastname = \"MOYER\""
] | Find all first-grade students who are NOT taught by OTHA MOYER. Report their first and last names. | SELECT DISTINCT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER" | student_1 |
[
"How many teachers are there?",
"Show me the classroom of OTHA MOYER.",
"What about classrooms other than that?",
"Give me the name of all first-grade students who are in any of those classrooms."
] | [
"SELECT COUNT(*) FROM teachers",
"SELECT classroom FROM teachers WHERE firstname = \"OTHA\" AND lastname = \"MOYER\"",
"SELECT distinct classroom FROM list WHERE classroom not in SELECT classroom FROM teachers WHERE firstname = \"OTHA\" AND lastname = \"MOYER\"",
"SELECT DISTINCT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"OTHA\" AND T2.lastname = \"MOYER\""
] | Find the last names of the students in third grade that are not taught by COVIN JEROME. | SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 3 AND T2.firstname != "COVIN" AND T2.lastname != "JEROME" | student_1 |
[
"How many students are there in record?",
"What about that in terms of each grade?",
"Also include number of classrooms."
] | [
"SELECT count(*) FROM list",
"SELECT grade, count(*) FROM list GROUP BY grade",
"SELECT grade , count(DISTINCT classroom) , count(*) FROM list GROUP BY grade"
] | For each grade, report the grade, the number of classrooms in which it is taught and the total number of students in the grade. | SELECT grade , count(DISTINCT classroom) , count(*) FROM list GROUP BY grade | student_1 |
[
"How many classrooms are there?",
"How many students does each of them have?",
"Give me the classroom with the most of them."
] | [
"SELECT DISTINCT classroom FROM list",
"SELECT classroom, count(*) FROM list GROUP BY classroom",
"SELECT classroom FROM list GROUP BY classroom ORDER BY count(*) DESC LIMIT 1"
] | Which classroom has the most students? | SELECT classroom FROM list GROUP BY classroom ORDER BY count(*) DESC LIMIT 1 | student_1 |
[
"How many classrooms are there?",
"Show me the classrooms that any zero grade is in.",
"How many students are in each of those classrooms?"
] | [
"SELECT DISTINCT classroom FROM list",
"SELECT distinct classroom FROM list WHERE grade = '0'",
"SELECT classroom , count(*) FROM list WHERE grade = \"0\" GROUP BY classroom"
] | For each grade 0 classroom, report the total number of students. | SELECT classroom , count(*) FROM list WHERE grade = "0" GROUP BY classroom | student_1 |
[
"How many classrooms are there?",
"Show me the classrooms that any fourth-grade is in.",
"How many students are in each of those classrooms?"
] | [
"SELECT DISTINCT classroom FROM list",
"SELECT distinct classroom FROM list WHERE grade = '4'",
"SELECT classroom , count(*) FROM list WHERE grade = \"4\" GROUP BY classroom"
] | Report the total number of students for each fourth-grade classroom. | SELECT classroom , count(*) FROM list WHERE grade = "4" GROUP BY classroom | student_1 |
[
"How many students have major 600?",
"What is the maximum age of these students?",
"Please show the minimum age as well."
] | [
"SELECT count(*) FROM STUDENT WHERE Major = 600",
"SELECT max(Age) FROM STUDENT WHERE Major = 600",
"SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600"
] | What are the maximum and minimum age of students with major 600? | SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600 | voter_2 |
[
"How many students have secretary votes?",
"How many of those are from the fall election cycle?",
"What are the names of those students?",
"What are their ages?"
] | [
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = \"Fall\"",
"SELECT DISTINCT T1.Fname, T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = \"Fall\"",
"SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = \"Fall\""
] | Find the distinct ages of students who have secretary votes in the fall election cycle. | SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = "Fall" | voter_2 |
[
"How many students have treasurer votes?",
"How many of those are from the spring election cycle?",
"Please list their names.",
"Who are their advisors?"
] | [
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = \"Spring\"",
"SELECT DISTINCT T1.Fname, T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = \"Spring\"",
"SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = \"Spring\""
] | Find the distinct Advisor of students who have treasurer votes in the spring election cycle. | SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = "Spring" | voter_2 |
[
"How many students have president votes?",
"How many of them are female?",
"What are their first and last names?"
] | [
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_Vote",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_Vote WHERE T1.sex = \"F\"",
"SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = \"F\""
] | Find the first and last names of all the female (sex is F) students who have president votes. | SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = "F" | voter_2 |
[
"How many students have vice President votes?",
"What are their names?",
"How many of them are 18 years old?",
"What are their first and last names?"
] | [
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Vice_President_Vote",
"SELECT DISTINCT T1.Fname, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Vice_President_Vote",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Vice_President_Vote WHERE T1.age = 18",
"SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18"
] | Find the first and last name of all the students of age 18 who have vice president votes. | SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18 | voter_2 |
[
"How many students have class senator votes?",
"How many of those votes are from the fall election cycle?",
"How many are for male students?"
] | [
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T2.Election_Cycle = \"Fall\"",
"SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = \"M\" AND T2.Election_Cycle = \"Fall\""
] | How many male (sex is M) students have class senator votes in the fall election cycle? | SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = "M" AND T2.Election_Cycle = "Fall" | voter_2 |
[
"Count the number of students whose city code is NYC.",
"What are their names?",
"How many of those students have class senator votes?",
"How many of those votes are from the spring election cycle?"
] | [
"SELECT count(*) FROM STUDENT WHERE city_code = \"NYC\"",
"SELECT FName, LName FROM STUDENT WHERE city_code = \"NYC\"",
"SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = \"NYC\"",
"SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = \"NYC\" AND T2.Election_Cycle = \"Spring\""
] | Find the number of students whose city code is NYC and who have class senator votes in the spring election cycle. | SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring" | voter_2 |
[
"Count the number of students whose city code is NYC.",
"How many have secretary votes?",
"Which of those students have votes from the spring election cycle? List their names.",
"What is their average age?"
] | [
"SELECT count(*) FROM STUDENT WHERE city_code = \"NYC\"",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = \"NYC\"",
"SELECT DISTINCT T1.FName, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = \"NYC\" AND T2.Election_Cycle = \"Spring\"",
"SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = \"NYC\" AND T2.Election_Cycle = \"Spring\""
] | Find the average age of students who live in the city with code "NYC" and have secretary votes in the spring election cycle. | SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring" | voter_2 |
[
"How many female students are there?",
"How many have secretary votes?",
"Which of them have votes from the spring election cycle? List their names.",
"What is their average age?"
] | [
"SELECT count(*) FROM STUDENT WHERE Sex = \"F\"",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.sex = \"F\"",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.sex = \"F\" AND T2.Election_cycle = \"Spring\"",
"SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = \"F\" AND T2.Election_Cycle = \"Spring\""
] | Find the average age of female (sex is F) students who have secretary votes in the spring election cycle. | SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = "F" AND T2.Election_Cycle = "Spring" | voter_2 |
[
"How many students have Vice President votes?",
"Count the number of those students whose city code is not PIT.",
"Please list their names.",
"Please only list their first names."
] | [
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = VICE_PRESIDENT_Vote",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = VICE_PRESIDENT_Vote WHERE city_code != \"PIT\"",
"SELECT DISTINCT T1.Fname, T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname, Lname FROM STUDENT WHERE city_code = \"PIT\"",
"SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = \"PIT\""
] | Find the distinct first names of all the students who have vice president votes and whose city code is not PIT. | SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = "PIT" | voter_2 |
[
"Which students have president votes?",
"How many of those students do not have advisor 2192?",
"What are their names?",
"Please only list last names."
] | [
"SELECT DISTINCT T1.Fname, T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.PRESIDENT_Vote",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.PRESIDENT_Vote WHERE T1.Advisor != \"2192\"",
"SELECT DISTINCT T1.FName, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT FName, LName FROM STUDENT WHERE Advisor = \"2192\"",
"SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = \"2192\""
] | Find the distinct last names of all the students who have president votes and whose advisor is not 2192. | SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "2192" | voter_2 |
[
"How many students have president votes?",
"How many of those students have advisor 8741?",
"What are their names?",
"Please only list last names."
] | [
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.PRESIDENT_Vote",
"SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.PRESIDENT_Vote WHERE T1.Advisor = \"8741\"",
"SELECT DISTINCT T1.Fname, T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.PRESIDENT_Vote WHERE T1.Advisor = \"8741\"",
"SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = \"8741\""
] | Find the distinct last names of all the students who have president votes and whose advisor is 8741. | SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "8741" | voter_2 |
[
"What are all of the advisors?",
"How many advise 2 students or less?",
"How many advise more than 2 students?",
"Please report these advisors."
] | [
"SELECT DISTINCT Advisor FROM STUDENT",
"SELECT count(*) FROM (SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) <= 2)",
"SELECT count(*) FROM (SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2)",
"SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2"
] | Report all advisors that advise more than 2 students. | SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2 | voter_2 |
[
"Report all majors.",
"How many have 3 students or more?",
"How many have less than 3 students?",
"Report those majors with less than 3 students."
] | [
"SELECT DISTINCT Major FROM STUDENT",
"SELECT count(*) FROM (SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) >= 3)",
"SELECT count(*) FROM (SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3)",
"SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3"
] | Report all majors that have less than 3 students. | SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3 | voter_2 |
[
"Report all majors.",
"Report the number of students per major as well.",
"Order the majors by decreasing number of students.",
"Which major has the most students?"
] | [
"SELECT DISTINCT Major FROM STUDENT",
"SELECT Major, count(*) FROM STUDENT GROUP BY Major",
"SELECT Major, count(*) FROM STUDENT GROUP BY Major ORDER BY count(*) DESC",
"SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1"
] | Which major has the most students? | SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1 | voter_2 |
[
"List the majors of female students.",
"Order the majors by decreasing number of students.",
"What is the most common major?"
] | [
"SELECT DISTINCT Major FROM STUDENT WHERE Sex = \"F\"",
"SELECT DISTINCT Major FROM STUDENT WHERE Sex = \"F\" GROUP BY major ORDER BY count(*) DESC",
"SELECT Major FROM STUDENT WHERE Sex = \"F\" GROUP BY major ORDER BY count(*) DESC LIMIT 1"
] | What is the most common major among female (sex is F) students? | SELECT Major FROM STUDENT WHERE Sex = "F" GROUP BY major ORDER BY count(*) DESC LIMIT 1 | voter_2 |
[
"How many students live in each city?",
"List the cities from the one with the most students to the one with the least students.",
"How many students live in the most popular city?",
"What is the city code of the most popular city?"
] | [
"SELECT city_code, count(*) FROM STUDENT GROUP BY city_code",
"SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC",
"SELECT count(*) FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1",
"SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1"
] | What is the city_code of the city that the most students live in? | SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1 | voter_2 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.