db_id
stringlengths
3
31
query
stringlengths
18
577
question
stringlengths
3
224
schema
stringlengths
177
6.14k
primary_keys
stringlengths
16
545
foreign_keys
stringlengths
16
1.48k
election
SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Liberal"
Which committees have delegates from both democratic party and liberal party?
[Schema (values) (types)]: | election | county : county_id (text) , county_name (number) , population (text) , zip_code (number) | party : party_id (text) , year (number) , party (text) , governor (number) , lieutenant_governor (text) , comptroller (number) , attorney_general (number) , us_senate (text) | election : election_id (text) , counties_represented (number) , district (text) , delegate (number) , party (text) , first_elected (number) , committee (number);
[Primary Keys]: county : county_id, party : party_id, election : election_id
[Foreign Keys]: election : district = county : county_id | election : party = party : party_id
election
SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Liberal"
Find the committees that have delegates both from from the democratic party and the liberal party.
[Schema (values) (types)]: | election | county : county_id (text) , county_name (number) , population (text) , zip_code (number) | party : party_id (text) , year (number) , party (text) , governor (number) , lieutenant_governor (text) , comptroller (number) , attorney_general (number) , us_senate (text) | election : election_id (text) , counties_represented (number) , district (text) , delegate (number) , party (text) , first_elected (number) , committee (number);
[Primary Keys]: county : county_id, party : party_id, election : election_id
[Foreign Keys]: election : district = county : county_id | election : party = party : party_id
news_report
SELECT count(*) FROM journalist
How many journalists are there?
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Name FROM journalist ORDER BY Years_working ASC
List the names of journalists in ascending order of years working.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Nationality , Age FROM journalist
What are the nationalities and ages of journalists?
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Name FROM journalist WHERE Nationality = "England" OR Nationality = "Wales"
Show the names of journalists from "England" or "Wales".
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT avg(Years_working) FROM journalist
What is the average number of years spent working as a journalist?
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1
What is the nationality of the journalist with the largest number of years working?
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Nationality , COUNT(*) FROM journalist GROUP BY Nationality
Show the different nationalities and the number of journalists of each nationality.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Nationality FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Show the most common nationality for journalists.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3
Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Date , Name , venue FROM event ORDER BY Event_Attendance DESC
Show the dates, places, and names of events in descending order of the attendance.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT T3.Name , T2.Date FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID
Show the names of journalists and the dates of the events they reported.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT T3.Name , T2.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID ORDER BY T2.Event_Attendance ASC
Show the names of journalists and the names of the events they reported in ascending order
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT T3.Name , COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name
Show the names of journalists and the number of events they reported.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*) > 1
Show the names of journalists that have reported more than one event.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT Name FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report)
List the names of journalists who have not reported any event.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT avg(Event_Attendance) , max(Event_Attendance) FROM event
what are the average and maximum attendances of all events?
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT avg(t1.age) , avg(Years_working) , t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id = t2.journalist_id GROUP BY t2.work_type
Find the average age and experience working length of journalists working on different role type.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
news_report
SELECT venue , name FROM event ORDER BY Event_Attendance DESC LIMIT 2
List the event venues and names that have the top 2 most number of people attended.
[Schema (values) (types)]: | news_report | event : event_id (text) , date (number) , venue (text) , name (text) , event_attendance (text) | journalist : journalist_id (text) , name (number) , nationality (text) , age (text) , years_working (text) | news_report : journalist_id (text) , event_id (number) , work_type (text);
[Primary Keys]: event : event_id, journalist : journalist_id, news_report : journalist_id
[Foreign Keys]: news_report : event_id = event : event_id | news_report : journalist_id = journalist : journalist_id
restaurant_1
SELECT ResName FROM Restaurant;
Show me all the restaurants.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Address FROM Restaurant WHERE ResName = "Subway";
What is the address of the restaurant Subway?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Rating FROM Restaurant WHERE ResName = "Subway";
What is the rating of the restaurant Subway?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT ResTypeName FROM Restaurant_Type;
List all restaurant types.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = "Sandwich";
What is the description of the restaurant type Sandwich?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT ResName , Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1;
Which restaurants have highest rating? List the restaurant name and its rating.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Age FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
What is the age of student Linda Smith?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Sex FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
What is the gender of the student Linda Smith?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Fname , Lname FROM Student WHERE Major = 600;
List all students' first names and last names who majored in 600.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT city_code FROM Student WHERE Fname = "Linda" AND Lname = "Smith";
Which city does student Linda Smith live in?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT count(*) FROM Student WHERE Advisor = 1121;
Advisor 1121 has how many students?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Advisor , count(*) FROM Student GROUP BY Advisor ORDER BY count(Advisor) DESC LIMIT 1;
Which Advisor has most of students? List advisor and the number of students.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Major , count(*) FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1;
Which major has least number of students? List the major and the number of students.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Major , count(*) FROM Student GROUP BY Major HAVING count(Major) BETWEEN 2 AND 30;
Which major has between 2 and 30 number of students? List major and the number of students.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major = 600;
Which student's age is older than 18 and is majoring in 600? List each student's first and last name.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major != 600 AND Sex = 'F';
List all female students age is older than 18 who is not majoring in 600. List students' first name and last name.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT count(*) FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID = Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID HAVING Restaurant_Type.ResTypeName = 'Sandwich'
How many restaurant is the Sandwich type restaurant?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT sum(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith";
How long does student Linda Smith spend on the restaurant in total?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT count(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway";
How many times has the student Linda Smith visited Subway?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = "Linda" AND Student.Lname = "Smith" AND Restaurant.ResName = "Subway";
When did Linda Smith visit Subway?
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Restaurant.ResName , sum(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY sum(Visits_Restaurant.Spent) ASC LIMIT 1;
At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
restaurant_1
SELECT Student.Fname , Student.Lname FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID GROUP BY Student.StuID ORDER BY count(*) DESC LIMIT 1;
Which student visited restaurant most often? List student's first name and last name.
[Schema (values) (types)]: | restaurant_1 | Student : stuid (text) , lname (number) , fname (text) , age (text) , sex (number) , major (text) , advisor (number) , city_code (number) | Restaurant : resid (text) , resname (number) , address (text) , rating (text) | Type_Of_Restaurant : resid (text) , restypeid (number) | Restaurant_Type : restypeid (text) , restypename (number) , restypedescription (text) | Visits_Restaurant : stuid (text) , resid (number) , time (text) , spent (text);
[Primary Keys]: student : stuid, restaurant : resid, type_of_restaurant : restypeid
[Foreign Keys]: type_of_restaurant : restypeid = restaurant_type : restypeid | type_of_restaurant : resid = restaurant : resid | visits_restaurant : resid = restaurant : resid | visits_restaurant : stuid = student : stuid
customer_deliveries
SELECT actual_order_id FROM actual_orders WHERE order_status_code = 'Success'
Find the ids of orders whose status is 'Success'.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT t1.product_name , t1.product_price FROM products AS t1 JOIN regular_order_products AS t2 ON t1.product_id = t2.product_id GROUP BY t2.product_id ORDER BY count(*) DESC LIMIT 1
Find the name and price of the product that has been ordered the greatest number of times.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT count(*) FROM customers
Find the number of customers in total.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT count(DISTINCT payment_method) FROM customers
How many different payment methods are there?
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT truck_details FROM trucks ORDER BY truck_licence_number
Show the details of all trucks in the order of their license number.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1
Find the name of the most expensive product.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'
Find the names of customers who are not living in the state of California.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT customer_email , customer_name FROM customers WHERE payment_method = 'Visa'
List the names and emails of customers who payed by Visa card.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT t1.customer_name , t1.customer_phone FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'
Find the names and phone numbers of customers living in California state.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT state_province_county FROM addresses WHERE address_id NOT IN (SELECT employee_address_id FROM Employees)
Find the states which do not have any employee in their record.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT customer_name , customer_phone , customer_email FROM Customers ORDER BY date_became_customer
List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT customer_name FROM Customers ORDER BY date_became_customer LIMIT 5
Find the name of the first 5 customers.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT payment_method FROM Customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1
Find the payment method that is used most frequently.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT route_name FROM Delivery_Routes ORDER BY route_name
List the names of all routes in alphabetic order.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT t1.route_name FROM Delivery_Routes AS t1 JOIN Delivery_Route_Locations AS t2 ON t1.route_id = t2.route_id GROUP BY t1.route_id ORDER BY count(*) DESC LIMIT 1
Find the name of route that has the highest number of deliveries.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
customer_deliveries
SELECT t2.state_province_county , count(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county
List the state names and the number of customers living in each state.
[Schema (values) (types)]: | customer_deliveries | Products : product_id (text) , product_name (number) , product_price (text) , product_description (number) | Addresses : address_id (text) , address_details (number) , city (text) , zip_postcode (number) , state_province_county (text) , country (number) | Customers : customer_id (text) , payment_method (number) , customer_name (text) , customer_phone (number) , customer_email (text) , date_became_customer (number) | Regular_Orders : regular_order_id (text) , distributer_id (number) | Regular_Order_Products : regular_order_id (text) , product_id (number) | Actual_Orders : actual_order_id (text) , order_status_code (number) , regular_order_id (text) , actual_order_date (number) | Actual_Order_Products : actual_order_id (text) , product_id (number) | Customer_Addresses : customer_id (text) , address_id (number) , date_from (text) , address_type (number) , date_to (text) | Delivery_Routes : route_id (text) , route_name (number) , other_route_details (text) | Delivery_Route_Locations : location_code (text) , route_id (number) , location_address_id (text) , location_name (number) | Trucks : truck_id (text) , truck_licence_number (number) , truck_details (text) | Employees : employee_id (text) , employee_address_id (number) , employee_name (text) , employee_phone (number) | Order_Deliveries : location_code (text) , actual_order_id (number) , delivery_status_code (text) , driver_employee_id (number) , truck_id (text) , delivery_date (number);
[Primary Keys]: products : product_id, addresses : address_id, customers : customer_id, regular_orders : regular_order_id, regular_order_products : actual_order_id, actual_orders : route_id, actual_order_products : location_code, customer_addresses : truck_id, delivery_routes : employee_id
[Foreign Keys]: regular_orders : distributer_id = customers : customer_id | regular_order_products : regular_order_id = regular_orders : regular_order_id | regular_order_products : product_id = products : product_id | actual_orders : regular_order_id = regular_orders : regular_order_id | actual_order_products : actual_order_id = actual_orders : actual_order_id | actual_order_products : product_id = products : product_id | customer_addresses : address_id = addresses : address_id | customer_addresses : customer_id = customers : customer_id | delivery_route_locations : route_id = delivery_routes : route_id | delivery_route_locations : location_address_id = addresses : address_id | employees : employee_address_id = addresses : address_id | order_deliveries : driver_employee_id = employees : employee_id | order_deliveries : location_code = delivery_route_locations : location_code | order_deliveries : actual_order_id = actual_orders : actual_order_id | order_deliveries : truck_id = trucks : truck_id
icfp_1
SELECT count(*) FROM authors
How many authors are there?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(*) FROM authors
Count the number of authors.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(*) FROM inst
How many institutions are there?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(*) FROM inst
Count the number of institutions.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(*) FROM papers
How many papers are published in total?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(*) FROM papers
Count the number of total papers.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons"
What are the titles of papers published by "Jeremy Gibbons"?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Jeremy" AND t1.lname = "Gibbons"
Find the titles of all the papers written by "Jeremy Gibbons"
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon"
Find all the papers published by "Aaron Turon".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Aaron" AND t1.lname = "Turon"
Find the titles of all the papers written by "Aaron Turon".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori"
How many papers have "Atsushi Ohori" published?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Atsushi" AND t1.lname = "Ohori"
How many papers are "Atsushi Ohori" the author of?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume"
What is the name of the institution that "Matthias Blume" belongs to?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Matthias" AND t1.lname = "Blume"
Which institution is the author "Matthias Blume" belong to? Give me the name of the institution.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno"
Which institution does "Katsuhiro Ueno" belong to?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t3.name FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t1.fname = "Katsuhiro" AND t1.lname = "Ueno"
What is the name of the institution the author "Katsuhiro Ueno" belongs to?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford"
Who belong to the institution "University of Oxford"? Show the first names and last names.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Oxford"
Find the first names and last names of the authors whose institution affiliation is "University of Oxford".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google"
Which authors belong to the institution "Google"? Show the first names and last names.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google"
Find the first names and last names of the authors whose institution affiliation is "Google".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound"
What are the last names of the author of the paper titled "Binders Unbound"?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Binders Unbound"
Who is the author of the paper titled "Binders Unbound"? Give me the last name.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless"
Find the first and last name of the author(s) who wrote the paper "Nameless, Painless".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless"
What are the first and last name of the author who published the paper titled "Nameless, Painless"?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University"
What are the papers published under the institution "Indiana University"?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Indiana University"
List the titles of the papers whose authors are from the institution "Indiana University".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google"
Find all the papers published by the institution "Google".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT DISTINCT t1.title FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Google"
Which papers were written by authors from the institution "Google"?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University"
How many papers are published by the institution "Tokohu University"?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "Tokohu University"
Find the number of papers published by authors from the institution "Tokohu University".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania"
Find the number of papers published by the institution "University of Pennsylvania".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = "University of Pennsylvania"
How many papers are written by authors from the institution "University of Pennsylvania"?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers"
Find the papers which have "Olin Shivers" as an author.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Olin" AND t1.lname = "Shivers"
Which papers did the author "Olin Shivers" write? Give me the paper titles.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich"
Which papers have "Stephanie Weirich" as an author?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = "Stephanie" AND t1.lname = "Weirich"
Find the titles of the papers the author "Stephanie Weirich" wrote.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon"
Which paper is published in an institution in "USA" and have "Turon" as its second author?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "USA" AND t2.authorder = 2 AND t1.lname = "Turon"
Find papers whose second author has last name "Turon" and is affiliated with an institution in the country "USA".
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori"
Find the titles of papers whose first author is affiliated with an institution in the country "Japan" and has last name "Ohori"?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid JOIN inst AS t4 ON t2.instid = t4.instid WHERE t4.country = "Japan" AND t2.authorder = 1 AND t1.lname = "Ohori"
Which papers' first author is affiliated with an institution in the country "Japan" and has last name "Ohori"? Give me the titles of the papers.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY count(*) DESC LIMIT 1
What is the last name of the author that has published the most papers?
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid
icfp_1
SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY count(*) DESC LIMIT 1
Which author has written the most papers? Find his or her last name.
[Schema (values) (types)]: | icfp_1 | Inst : instid (text) , name (number) , country (text) | Authors : authid (text) , lname (number) , fname (text) | Papers : paperid (text) , title (number) | Authorship : authid (text) , instid (number) , paperid (text) , authorder (text);
[Primary Keys]: inst : instid, authors : authid, papers : paperid, authorship : authid
[Foreign Keys]: authorship : paperid = papers : paperid | authorship : instid = inst : instid | authorship : authid = authors : authid