Question:
What are the names of organizations that contain the word 'Party'?
Additional table information: table: e_government

Answer: SELECT organization_name FROM organizations WHERE organization_name LIKE '%Party%'


Question:
How many distinct payment methods are used by parties?
Additional table information: table: e_government

Answer: SELECT COUNT(DISTINCT payment_method_code) FROM parties


Question:
Count the number of different payment method codes used by parties.
Additional table information: table: e_government

Answer: SELECT COUNT(DISTINCT payment_method_code) FROM parties


Question:
Which is the email of the party that has used the services the most number of times?
Additional table information: table: e_government

Answer: SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id = t2.customer_id GROUP BY t1.party_email ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the party email that has used party services the greatest number of times.
Additional table information: table: e_government

Answer: SELECT t1.party_email FROM parties AS t1 JOIN party_services AS t2 ON t1.party_id = t2.customer_id GROUP BY t1.party_email ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which state can address '6862 Kaitlyn Knolls' possibly be in?
Additional table information: table: e_government

Answer: SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE '%6862 Kaitlyn Knolls%'


Question:
Give the state corresponding to the line number building '6862 Kaitlyn Knolls'.
Additional table information: table: e_government

Answer: SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE '%6862 Kaitlyn Knolls%'


Question:
What is the name of organization that has the greatest number of contact individuals?
Additional table information: table: e_government

Answer: SELECT t1.organization_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id GROUP BY t1.organization_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the name of the organization which has the most contact individuals.
Additional table information: table: e_government

Answer: SELECT t1.organization_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id GROUP BY t1.organization_name ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the last name of the individuals that have been contact individuals of an organization.
Additional table information: table: e_government

Answer: SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id


Question:
What are the last names of individuals who have been contact individuals for an organization?
Additional table information: table: e_government

Answer: SELECT DISTINCT t1.individual_last_name FROM individuals AS t1 JOIN organization_contact_individuals AS t2 ON t1.individual_id = t2.individual_id


Question:
How many drivers are there?
Additional table information: table: school_bus

Answer: SELECT COUNT(*) FROM driver


Question:
Show the name, home city, and age for all drivers.
Additional table information: table: school_bus

Answer: SELECT name, home_city, age FROM driver


Question:
Show the party and the number of drivers in each party.
Additional table information: table: school_bus

Answer: SELECT party, COUNT(*) FROM driver GROUP BY party


Question:
Show the name of drivers in descending order of age.
Additional table information: table: school_bus

Answer: SELECT name FROM driver ORDER BY age DESC


Question:
Show all different home cities.
Additional table information: table: school_bus

Answer: SELECT DISTINCT home_city FROM driver


Question:
Show the home city with the most number of drivers.
Additional table information: table: school_bus

Answer: SELECT home_city FROM driver GROUP BY home_city ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the party with drivers from Hartford and drivers older than 40.
Additional table information: table: school_bus

Answer: SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40


Question:
Show home city where at least two drivers older than 40 are from.
Additional table information: table: school_bus

Answer: SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING COUNT(*) >= 2


Question:
Show all home cities except for those having a driver older than 40.
Additional table information: table: school_bus

Answer: SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40


Question:
Show the names of the drivers without a school bus.
Additional table information: table: school_bus

Answer: SELECT name FROM driver WHERE NOT driver_id IN (SELECT driver_id FROM school_bus)


Question:
Show the types of schools that have two schools.
Additional table information: table: school_bus

Answer: SELECT TYPE FROM school GROUP BY TYPE HAVING COUNT(*) = 2


Question:
Show the school name and driver name for all school buses.
Additional table information: table: school_bus

Answer: SELECT T2.school, T3.name FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN driver AS T3 ON T1.driver_id = T3.driver_id


Question:
What is the maximum, minimum and average years spent working on a school bus?
Additional table information: table: school_bus

Answer: SELECT MAX(years_working), MIN(years_working), AVG(years_working) FROM school_bus


Question:
Show the school name and type for schools without a school bus.
Additional table information: table: school_bus

Answer: SELECT school, TYPE FROM school WHERE NOT school_id IN (SELECT school_id FROM school_bus)


Question:
Show the type of school and the number of buses for each type.
Additional table information: table: school_bus

Answer: SELECT T2.type, COUNT(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.type


Question:
How many drivers are from Hartford city or younger than 40?
Additional table information: table: school_bus

Answer: SELECT COUNT(*) FROM driver WHERE home_city = 'Hartford' OR age < 40


Question:
List names for drivers from Hartford city and younger than 40.
Additional table information: table: school_bus

Answer: SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40


Question:
find the name of driver who is driving the school bus with the longest working history.
Additional table information: table: school_bus

Answer: SELECT t1.name FROM driver AS t1 JOIN school_bus AS t2 ON t1.driver_id = t2.driver_id ORDER BY years_working DESC LIMIT 1


Question:
How many flights have a velocity larger than 200?
Additional table information: table: flight_company

Answer: SELECT COUNT(*) FROM flight WHERE velocity > 200


Question:
List the vehicle flight number, date and pilot of all the flights, ordered by altitude.
Additional table information: table: flight_company

Answer: SELECT vehicle_flight_number, date, pilot FROM flight ORDER BY altitude ASC NULLS FIRST


Question:
List the id, country, city and name of the airports ordered alphabetically by the name.
Additional table information: table: flight_company

Answer: SELECT id, country, city, name FROM airport ORDER BY name NULLS FIRST


Question:
What is maximum group equity shareholding of the companies?
Additional table information: table: flight_company

Answer: SELECT MAX(group_equity_shareholding) FROM operate_company


Question:
What is the velocity of the pilot named 'Thompson'?
Additional table information: table: flight_company

Answer: SELECT AVG(velocity) FROM flight WHERE pilot = 'Thompson'


Question:
What are the names and types of the companies that have ever operated a flight?
Additional table information: table: flight_company

Answer: SELECT T1.name, T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id


Question:
What are the names of the airports which are not in the country 'Iceland'?
Additional table information: table: flight_company

Answer: SELECT name FROM airport WHERE country <> 'Iceland'


Question:
What are the distinct types of the companies that have operated any flights with velocity less than 200?
Additional table information: table: flight_company

Answer: SELECT DISTINCT T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T2.velocity < 200


Question:
What are the ids and names of the companies that operated more than one flight?
Additional table information: table: flight_company

Answer: SELECT T1.id, T1.name FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id GROUP BY T1.id HAVING COUNT(*) > 1


Question:
What is the id, name and IATA code of the airport that had most number of flights?
Additional table information: table: flight_company

Answer: SELECT T1.id, T1.name, T1.IATA FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id GROUP BY T2.id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
Additional table information: table: flight_company

Answer: SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = 'United States' OR T1.name = 'Billund Airport'


Question:
What is the most common company type, and how many are there?
Additional table information: table: flight_company

Answer: SELECT TYPE, COUNT(*) FROM operate_company GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many airports haven't the pilot 'Thompson' driven an aircraft?
Additional table information: table: flight_company

Answer: SELECT COUNT(*) FROM airport WHERE NOT id IN (SELECT airport_id FROM flight WHERE pilot = 'Thompson')


Question:
List the name of the pilots who have flied for both a company that mainly provide 'Cargo' services and a company that runs 'Catering services' activities.
Additional table information: table: flight_company

Answer: SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Cargo' INTERSECT SELECT T2.pilot FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T1.principal_activities = 'Catering services'


Question:
Which of the airport names contains the word 'international'?
Additional table information: table: flight_company

Answer: SELECT name FROM airport WHERE name LIKE '%international%'


Question:
How many companies operates airlines in each airport?
Additional table information: table: flight_company

Answer: SELECT T3.id, COUNT(*) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id JOIN airport AS T3 ON T2.airport_id = T3.id GROUP BY T3.id


Question:
how many airports are there in each country?
Additional table information: table: flight_company

Answer: SELECT COUNT(*), country FROM airport GROUP BY country


Question:
which countries have more than 2 airports?
Additional table information: table: flight_company

Answer: SELECT country FROM airport GROUP BY country HAVING COUNT(*) > 2


Question:
which pilot is in charge of the most number of flights?
Additional table information: table: flight_company

Answer: SELECT pilot FROM flight GROUP BY pilot ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many accounts do we have?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Accounts


Question:
Count the number of accounts.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Accounts


Question:
Show all account ids and account details.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT account_id, account_details FROM Accounts


Question:
What are the ids and details of all accounts?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT account_id, account_details FROM Accounts


Question:
How many statements do we have?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Statements


Question:
Count the number of statements.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Statements


Question:
List all statement ids and statement details.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT STATEMENT_ID, statement_details FROM Statements


Question:
What are the ids and details of all statements?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT STATEMENT_ID, statement_details FROM Statements


Question:
Show statement id, statement detail, account detail for accounts.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_id, T2.statement_details, T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id


Question:
What are the statement ids, statement details, and account details, for all accounts?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_id, T2.statement_details, T1.account_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id


Question:
Show all statement id and the number of accounts for each statement.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT STATEMENT_ID, COUNT(*) FROM Accounts GROUP BY STATEMENT_ID


Question:
What are the different statement ids on accounts, and the number of accounts for each?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT STATEMENT_ID, COUNT(*) FROM Accounts GROUP BY STATEMENT_ID


Question:
Show the statement id and the statement detail for the statement with most number of accounts.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_id, T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the statement id and statement detail for the statement that has the most corresponding accounts?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_id, T2.statement_details FROM Accounts AS T1 JOIN Statements AS T2 ON T1.statement_id = T2.statement_id GROUP BY T1.statement_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the number of documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents


Question:
Count the number of documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents


Question:
List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code, document_name, document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'


Question:
What are the type come, name, and description of the document that has either the name 'Noel CV' or 'King Book'?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code, document_name, document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'


Question:
Show the ids and names of all documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id, document_name FROM Documents


Question:
What are the ids and names for each of the documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id, document_name FROM Documents


Question:
Find names and ids of all documents with document type code BK.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_name, document_id FROM Documents WHERE document_type_code = 'BK'


Question:
What are the names and ids of documents that have the type code BK?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_name, document_id FROM Documents WHERE document_type_code = 'BK'


Question:
How many documents are with document type code BK for each product id?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*), project_id FROM Documents WHERE document_type_code = 'BK' GROUP BY project_id


Question:
Count the number of documents with the type code BK that correspond to each product id.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*), project_id FROM Documents WHERE document_type_code = 'BK' GROUP BY project_id


Question:
Show the document name and the document date for all documents on project with details 'Graph Database project'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_name, document_date FROM Documents AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'Graph Database project'


Question:
What are the names and dates for documents corresponding to project that has the details 'Graph Database project'?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_name, document_date FROM Documents AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'Graph Database project'


Question:
Show project ids and the number of documents in each project.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id, COUNT(*) FROM Documents GROUP BY project_id


Question:
How many documents correspond with each project id?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id, COUNT(*) FROM Documents GROUP BY project_id


Question:
What is the id of the project with least number of documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id FROM Documents GROUP BY project_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Return the id of the project that has the fewest corresponding documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id FROM Documents GROUP BY project_id ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Show the ids for projects with at least 2 documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id FROM Documents GROUP BY project_id HAVING COUNT(*) >= 2


Question:
What are project ids of projects that have 2 or more corresponding documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id FROM Documents GROUP BY project_id HAVING COUNT(*) >= 2


Question:
List document type codes and the number of documents in each code.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code, COUNT(*) FROM Documents GROUP BY document_type_code


Question:
How many documents are there of each type?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code, COUNT(*) FROM Documents GROUP BY document_type_code


Question:
What is the document type code with most number of documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the code of the document type that is most common.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the document type code with fewer than 3 documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING COUNT(*) < 3


Question:
What are the codes corresponding to document types for which there are less than 3 documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING COUNT(*) < 3


Question:
Show the statement detail and the corresponding document name for the statement with detail 'Private Project'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_details, T2.document_name FROM Statements AS T1 JOIN Documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'


Question:
What are the details for statements with the details 'Private Project', and what are the names of the corresponding documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.statement_details, T2.document_name FROM Statements AS T1 JOIN Documents AS T2 ON T1.statement_id = T2.document_id WHERE T1.statement_details = 'Private Project'


Question:
Show all document type codes, document type names, document type descriptions.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code, document_type_name, document_type_description FROM Ref_document_types


Question:
What are the codes, names, and descriptions of the different document types?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_code, document_type_name, document_type_description FROM Ref_document_types


Question:
What is the document type description for document type named Film?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_description FROM Ref_document_types WHERE document_type_name = 'Film'


Question:
Return the description of the document type name 'Film'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_type_description FROM Ref_document_types WHERE document_type_name = 'Film'


Question:
What is the document type name and the document type description and creation date for all the documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_type_name, T1.document_type_description, T2.Document_date FROM Ref_document_types AS T1 JOIN Documents AS T2 ON T1.document_type_code = T2.document_type_code


Question:
Return the type name, type description, and date of creation for each document.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_type_name, T1.document_type_description, T2.Document_date FROM Ref_document_types AS T1 JOIN Documents AS T2 ON T1.document_type_code = T2.document_type_code


Question:
Show the number of projects.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Projects


Question:
How many projects are there?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Projects


Question:
List ids and details for all projects.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id, project_details FROM Projects


Question:
What are the ids and details for each project?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT project_id, project_details FROM Projects


Question:
What is the project id and detail for the project with at least two documents?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.project_id, T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id HAVING COUNT(*) > 2


Question:
Return the ids and details corresponding to projects for which there are more than two documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.project_id, T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id HAVING COUNT(*) > 2


Question:
What is the project detail for the project with document 'King Book'?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = 'King Book'


Question:
Give the details of the project with the document name 'King Book'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = 'King Book'


Question:
How many budget types do we have?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Ref_budget_codes


Question:
Count the number of budget codes.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Ref_budget_codes


Question:
List all budget type codes and descriptions.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code, budget_type_description FROM Ref_budget_codes


Question:
What are the type codes and descriptions of each budget type?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code, budget_type_description FROM Ref_budget_codes


Question:
What is the description for the budget type with code ORG?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = 'ORG'


Question:
Return the description of the budget type that has the code ORG.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = 'ORG'


Question:
How many documents have expenses?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents_with_expenses


Question:
Count the number of documents with expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents_with_expenses


Question:
What are the document ids for the budget type code 'SF'?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'


Question:
Give the ids of documents with expenses that have the budget code 'SF'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'


Question:
Show the budget type code and description and the corresponding document id.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T2.budget_type_code, T2.budget_type_description, T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_budget_codes AS T2 ON T1.budget_type_code = T2.budget_type_code


Question:
Return the budget type codes, budget type descriptions and document ids for documents with expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T2.budget_type_code, T2.budget_type_description, T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_budget_codes AS T2 ON T1.budget_type_code = T2.budget_type_code


Question:
Show ids for all documents with budget types described as 'Government'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code = T2.Budget_Type_code WHERE T2.budget_type_Description = 'Government'


Question:
Give the ids for documents that have the budget description 'Government'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_id FROM Documents_with_expenses AS T1 JOIN Ref_Budget_Codes AS T2 ON T1.Budget_Type_code = T2.Budget_Type_code WHERE T2.budget_type_Description = 'Government'


Question:
Show budget type codes and the number of documents in each budget type.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code, COUNT(*) FROM Documents_with_expenses GROUP BY budget_type_code


Question:
What are the different budget type codes, and how many documents are there for each?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code, COUNT(*) FROM Documents_with_expenses GROUP BY budget_type_code


Question:
What is the budget type code with most number of documents.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
Give the budget type code that is most common among documents with expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the ids of documents which don't have expense budgets?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses


Question:
Return the ids of documents that do not have expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses


Question:
Show ids for all documents in type CV without expense budgets.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents WHERE document_type_code = 'CV' EXCEPT SELECT document_id FROM Documents_with_expenses


Question:
What are the ids of documents with the type code CV that do not have expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT document_id FROM Documents WHERE document_type_code = 'CV' EXCEPT SELECT document_id FROM Documents_with_expenses


Question:
What are the ids of documents with letter 's' in the name with any expense budgets.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id = T2.document_id WHERE T1.document_name LIKE '%s%'


Question:
Give the ids of documents that have expenses and contain the letter s in their names.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id = T2.document_id WHERE T1.document_name LIKE '%s%'


Question:
How many documents do not have any expense?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents WHERE NOT document_id IN (SELECT document_id FROM Documents_with_expenses)


Question:
Count the number of documents that do not have expenses.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT COUNT(*) FROM Documents WHERE NOT document_id IN (SELECT document_id FROM Documents_with_expenses)


Question:
What are the dates for the documents with both 'GV' type and 'SF' type expenses?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'GV' INTERSECT SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'SF'


Question:
Give the dates of creation for documents that have both budget type codes 'GV' and 'SF'.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'GV' INTERSECT SELECT T1.document_date FROM Documents AS T1 JOIN Documents_with_Expenses AS T2 ON T1.document_id = T2.document_id WHERE T2.budget_type_code = 'SF'


Question:
What are the account details with the largest value or with value having char '5' in it?
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT MAX(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE '%5%'


Question:
Return the account details with the greatest value, as well as those that include the character 5.
Additional table information: table: cre_Docs_and_Epenses

Answer: SELECT MAX(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE '%5%'


Question:
Find the total number of scientists.
Additional table information: table: scientist_1

Answer: SELECT COUNT(*) FROM scientists


Question:
How many scientists are there?
Additional table information: table: scientist_1

Answer: SELECT COUNT(*) FROM scientists


Question:
Find the total hours of all projects.
Additional table information: table: scientist_1

Answer: SELECT SUM(hours) FROM projects


Question:
What is the total number of hours for all projects?
Additional table information: table: scientist_1

Answer: SELECT SUM(hours) FROM projects


Question:
How many different scientists are assigned to any project?
Additional table information: table: scientist_1

Answer: SELECT COUNT(DISTINCT scientist) FROM assignedto


Question:
Count the number of different scientists assigned to any project.
Additional table information: table: scientist_1

Answer: SELECT COUNT(DISTINCT scientist) FROM assignedto


Question:
Find the number of distinct projects.
Additional table information: table: scientist_1

Answer: SELECT COUNT(DISTINCT name) FROM projects


Question:
How many different projects are there?
Additional table information: table: scientist_1

Answer: SELECT COUNT(DISTINCT name) FROM projects


Question:
Find the average hours of all projects.
Additional table information: table: scientist_1

Answer: SELECT AVG(hours) FROM projects


Question:
What is the average hours across all projects?
Additional table information: table: scientist_1

Answer: SELECT AVG(hours) FROM projects


Question:
Find the name of project that continues for the longest time.
Additional table information: table: scientist_1

Answer: SELECT name FROM projects ORDER BY hours DESC LIMIT 1


Question:
What is the name of the project with the most hours?
Additional table information: table: scientist_1

Answer: SELECT name FROM projects ORDER BY hours DESC LIMIT 1


Question:
List the name of all projects that are operated longer than the average working hours of all projects.
Additional table information: table: scientist_1

Answer: SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)


Question:
What are the names of projects that have taken longer than the average number of hours for all projects?
Additional table information: table: scientist_1

Answer: SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)


Question:
Find the name and hours of project that has the most number of scientists.
Additional table information: table: scientist_1

Answer: SELECT T1.name, T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T2.project ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the name and hours for the project which has the most scientists assigned to it?
Additional table information: table: scientist_1

Answer: SELECT T1.name, T1.hours FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T2.project ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to.
Additional table information: table: scientist_1

Answer: SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name LIKE '%Smith%'


Question:
What is the name of the project that has a scientist assigned to it whose name contains 'Smith'?
Additional table information: table: scientist_1

Answer: SELECT T2.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name LIKE '%Smith%'


Question:
Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to.
Additional table information: table: scientist_1

Answer: SELECT SUM(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name = 'Michael Rogers' OR T3.name = 'Carol Smith'


Question:
What is the sum of hours for projects that scientists with the name Michael Rogers or Carol Smith are assigned to?
Additional table information: table: scientist_1

Answer: SELECT SUM(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name = 'Michael Rogers' OR T3.name = 'Carol Smith'


Question:
Find the name of projects that require between 100 and 300 hours of work.
Additional table information: table: scientist_1

Answer: SELECT name FROM projects WHERE hours BETWEEN 100 AND 300


Question:
What are the names of projects that require between 100 and 300 hours?
Additional table information: table: scientist_1

Answer: SELECT name FROM projects WHERE hours BETWEEN 100 AND 300


Question:
Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'.
Additional table information: table: scientist_1

Answer: SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'A Puzzling Parallax'


Question:
What are the names of any scientists who worked on projects named 'Matter of Time' and 'A Puzzling Pattern'?
Additional table information: table: scientist_1

Answer: SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'Matter of Time' INTERSECT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.name = 'A Puzzling Parallax'


Question:
List the names of all scientists sorted in alphabetical order.
Additional table information: table: scientist_1

Answer: SELECT name FROM scientists ORDER BY name NULLS FIRST


Question:
What are the names of all the scientists in alphabetical order?
Additional table information: table: scientist_1

Answer: SELECT name FROM scientists ORDER BY name NULLS FIRST


Question:
Find the number of scientists involved for each project name.
Additional table information: table: scientist_1

Answer: SELECT COUNT(*), T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name


Question:
What are the naems of all the projects, and how many scientists were assigned to each of them?
Additional table information: table: scientist_1

Answer: SELECT COUNT(*), T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name


Question:
Find the number of scientists involved for the projects that require more than 300 hours.
Additional table information: table: scientist_1

Answer: SELECT COUNT(*), T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project WHERE T1.hours > 300 GROUP BY T1.name


Question:
What are the names of projects that require more than 300 hours, and how many scientists are assigned to each?
Additional table information: table: scientist_1

Answer: SELECT COUNT(*), T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project WHERE T1.hours > 300 GROUP BY T1.name


Question:
Find the number of projects which each scientist is working on and scientist's name.
Additional table information: table: scientist_1

Answer: SELECT COUNT(*), T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist GROUP BY T1.name


Question:
What are the names of the scientists, and how many projects are each of them working on?
Additional table information: table: scientist_1

Answer: SELECT COUNT(*), T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist GROUP BY T1.name


Question:
Find the SSN and name of scientists who are assigned to the project with the longest hours.
Additional table information: table: scientist_1

Answer: SELECT T3.ssn, T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT MAX(hours) FROM projects)


Question:
What are the SSN and names of scientists working on the project with the most hours?
Additional table information: table: scientist_1

Answer: SELECT T3.ssn, T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT MAX(hours) FROM projects)


Question:
Find the name of scientists who are assigned to some project.
Additional table information: table: scientist_1

Answer: SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist = T2.ssn


Question:
What are the names of scientists who are assigned to any project?
Additional table information: table: scientist_1

Answer: SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist = T2.ssn


Question:
Select the project names which are not assigned yet.
Additional table information: table: scientist_1

Answer: SELECT Name FROM Projects WHERE NOT Code IN (SELECT Project FROM AssignedTo)


Question:
What are the names of projects that have not been assigned?
Additional table information: table: scientist_1

Answer: SELECT Name FROM Projects WHERE NOT Code IN (SELECT Project FROM AssignedTo)


Question:
Find the name of scientists who are not assigned to any project.
Additional table information: table: scientist_1

Answer: SELECT Name FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)


Question:
What are the names of scientists who have not been assigned a project?
Additional table information: table: scientist_1

Answer: SELECT Name FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)


Question:
Find the number of scientists who are not assigned to any project.
Additional table information: table: scientist_1

Answer: SELECT COUNT(*) FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)


Question:
How many scientists do not have any projects assigned to them?
Additional table information: table: scientist_1

Answer: SELECT COUNT(*) FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)


Question:
Find the names of scientists who are not working on the project with the highest hours.
Additional table information: table: scientist_1

Answer: SELECT name FROM scientists EXCEPT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT MAX(hours) FROM projects)


Question:
What are the names of scientists who are not working on the project with the most hours?
Additional table information: table: scientist_1

Answer: SELECT name FROM scientists EXCEPT SELECT T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT MAX(hours) FROM projects)


Question:
List all the scientists' names, their projects' names, and the hours worked by that scientist on each project, in alphabetical order of project name, and then scientist name.
Additional table information: table: scientist_1

Answer: SELECT T1.Name, T3.Name, T3.Hours FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist JOIN Projects AS T3 ON T2.Project = T3.Code ORDER BY T3.Name NULLS FIRST, T1.Name NULLS FIRST


Question:
What are the names of each scientist, the names of the projects that they work on, and the hours for each of those projects, listed in alphabetical order by project name, then scientist name.
Additional table information: table: scientist_1

Answer: SELECT T1.Name, T3.Name, T3.Hours FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist JOIN Projects AS T3 ON T2.Project = T3.Code ORDER BY T3.Name NULLS FIRST, T1.Name NULLS FIRST


Question:
Find name of the project that needs the least amount of time to finish and the name of scientists who worked on it.
Additional table information: table: scientist_1

Answer: SELECT T2.name, T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT MIN(hours) FROM projects)


Question:
What is the name of the project that requires the fewest number of hours, and the names of the scientists assigned to it?
Additional table information: table: scientist_1

Answer: SELECT T2.name, T3.name FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T2.hours = (SELECT MIN(hours) FROM projects)


Question:
What is the name of the highest rated wine?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE ORDER BY Score NULLS FIRST LIMIT 1


Question:
Give the name of the wine with the highest score.
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE ORDER BY Score NULLS FIRST LIMIT 1


Question:
Which winery is the wine that has the highest score from?
Additional table information: table: wine_1

Answer: SELECT Winery FROM WINE ORDER BY SCORE NULLS FIRST LIMIT 1


Question:
What is the winery at which the wine with the highest score was made?
Additional table information: table: wine_1

Answer: SELECT Winery FROM WINE ORDER BY SCORE NULLS FIRST LIMIT 1


Question:
Find the names of all wines produced in 2008.
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE YEAR = '2008'


Question:
What are the names of all wines produced in 2008?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE YEAR = '2008'


Question:
List the grapes and appelations of all wines.
Additional table information: table: wine_1

Answer: SELECT Grape, Appelation FROM WINE


Question:
What are the grapes and appelations of each wine?
Additional table information: table: wine_1

Answer: SELECT Grape, Appelation FROM WINE


Question:
List the names and scores of all wines.
Additional table information: table: wine_1

Answer: SELECT Name, Score FROM WINE


Question:
What are the names and scores of all wines?
Additional table information: table: wine_1

Answer: SELECT Name, Score FROM WINE


Question:
List the area and county of all appelations.
Additional table information: table: wine_1

Answer: SELECT Area, County FROM APPELLATIONS


Question:
What are the areas and counties for all appelations?
Additional table information: table: wine_1

Answer: SELECT Area, County FROM APPELLATIONS


Question:
What are the prices of wines produced before the year of 2010?
Additional table information: table: wine_1

Answer: SELECT Price FROM WINE WHERE YEAR < 2010


Question:
Return the prices of wines produced before 2010.
Additional table information: table: wine_1

Answer: SELECT Price FROM WINE WHERE YEAR < 2010


Question:
List the names of all distinct wines that have scores higher than 90.
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE score > 90


Question:
What are the names of wines with scores higher than 90?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE score > 90


Question:
List the names of all distinct wines that are made of red color grape.
Additional table information: table: wine_1

Answer: SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'Red'


Question:
What are the names of wines made from red grapes?
Additional table information: table: wine_1

Answer: SELECT DISTINCT T2.Name FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'Red'


Question:
Find the names of all distinct wines that have appellations in North Coast area.
Additional table information: table: wine_1

Answer: SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'North Coast'


Question:
What are the distinct names of wines that have appellations in the North Coast area?
Additional table information: table: wine_1

Answer: SELECT DISTINCT T2.Name FROM APPELLATIONs AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'North Coast'


Question:
How many wines are produced at Robert Biale winery?
Additional table information: table: wine_1

Answer: SELECT COUNT(*) FROM WINE WHERE Winery = 'Robert Biale'


Question:
Count the number of wines produced at Robert Biale winery.
Additional table information: table: wine_1

Answer: SELECT COUNT(*) FROM WINE WHERE Winery = 'Robert Biale'


Question:
How many appelations are in Napa Country?
Additional table information: table: wine_1

Answer: SELECT COUNT(*) FROM APPELLATIONS WHERE County = 'Napa'


Question:
Count the number of appelations in Napa County.
Additional table information: table: wine_1

Answer: SELECT COUNT(*) FROM APPELLATIONS WHERE County = 'Napa'


Question:
Give me the average prices of wines that are produced by appelations in Sonoma County.
Additional table information: table: wine_1

Answer: SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma'


Question:
What is the average price of wines produced in appelations in Sonoma County?
Additional table information: table: wine_1

Answer: SELECT AVG(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma'


Question:
What are the names and scores of wines that are made of white color grapes?
Additional table information: table: wine_1

Answer: SELECT T2.Name, T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White'


Question:
Give the names and scores of wines made from white grapes.
Additional table information: table: wine_1

Answer: SELECT T2.Name, T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White'


Question:
Find the maximum price of wins from the appelations in Central Coast area and produced before the year of 2005.
Additional table information: table: wine_1

Answer: SELECT MAX(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'Central Coast' AND T2.year < 2005


Question:
What is the maximum price of wines from the appelation in the Central Coast area, which was produced before 2005?
Additional table information: table: wine_1

Answer: SELECT MAX(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = 'Central Coast' AND T2.year < 2005


Question:
Find the the grape whose white color grapes are used to produce wines with scores higher than 90.
Additional table information: table: wine_1

Answer: SELECT DISTINCT T1.Grape FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White' AND T2.score > 90


Question:
Find the white grape used to produce wines with scores above 90.
Additional table information: table: wine_1

Answer: SELECT DISTINCT T1.Grape FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'White' AND T2.score > 90


Question:
What are the wines that have prices higher than 50 and made of Red color grapes?
Additional table information: table: wine_1

Answer: SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'Red' AND T2.price > 50


Question:
What are the names of wines made from red grapes and with prices above 50?
Additional table information: table: wine_1

Answer: SELECT T2.Name FROM Grapes AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = 'Red' AND T2.price > 50


Question:
What are the wines that have prices lower than 50 and have appelations in Monterey county?
Additional table information: table: wine_1

Answer: SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Monterey' AND T2.price < 50


Question:
Give the neames of wines with prices below 50 and with appelations in Monterey county.
Additional table information: table: wine_1

Answer: SELECT T2.Name FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Monterey' AND T2.price < 50


Question:
What are the numbers of wines for different grapes?
Additional table information: table: wine_1

Answer: SELECT COUNT(*), Grape FROM WINE GROUP BY Grape


Question:
How many wines are there for each grape?
Additional table information: table: wine_1

Answer: SELECT COUNT(*), Grape FROM WINE GROUP BY Grape


Question:
What are the average prices of wines for different years?
Additional table information: table: wine_1

Answer: SELECT AVG(Price), YEAR FROM WINE GROUP BY YEAR


Question:
What is the average prices of wines for each each?
Additional table information: table: wine_1

Answer: SELECT AVG(Price), YEAR FROM WINE GROUP BY YEAR


Question:
Find the distinct names of all wines that have prices higher than some wines from John Anthony winery.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE WHERE Price > (SELECT MIN(Price) FROM wine WHERE Winery = 'John Anthony')


Question:
What are the distinct names of wines with prices higher than any wine from John Anthony winery.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE WHERE Price > (SELECT MIN(Price) FROM wine WHERE Winery = 'John Anthony')


Question:
List the names of all distinct wines in alphabetical order.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE ORDER BY Name NULLS FIRST


Question:
What are the names of wines, sorted in alphabetical order?
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE ORDER BY Name NULLS FIRST


Question:
List the names of all distinct wines ordered by price.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE ORDER BY price NULLS FIRST


Question:
What are the names of wines, sorted by price ascending?
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE ORDER BY price NULLS FIRST


Question:
What is the area of the appelation that produces the highest number of wines before the year of 2010?
Additional table information: table: wine_1

Answer: SELECT T1.Area FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING T2.year < 2010 ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the area for the appelation which produced the most wines prior to 2010?
Additional table information: table: wine_1

Answer: SELECT T1.Area FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING T2.year < 2010 ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the color of the grape whose wine products has the highest average price?
Additional table information: table: wine_1

Answer: SELECT T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC LIMIT 1


Question:
Give the color of the grape whose wine products have the highest average price?
Additional table information: table: wine_1

Answer: SELECT T1.Color FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape GROUP BY T2.Grape ORDER BY AVG(Price) DESC LIMIT 1


Question:
Find the distinct names of wines produced before the year of 2000 or after the year of 2010.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE WHERE YEAR < 2000 OR YEAR > 2010


Question:
Give the distinct names of wines made before 2000 or after 2010.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Name FROM WINE WHERE YEAR < 2000 OR YEAR > 2010


Question:
Find the distinct winery of wines having price between 50 and 100.
Additional table information: table: wine_1

Answer: SELECT DISTINCT Winery FROM WINE WHERE Price BETWEEN 50 AND 100


Question:
What are the distinct wineries which produce wines costing between 50 and 100?
Additional table information: table: wine_1

Answer: SELECT DISTINCT Winery FROM WINE WHERE Price BETWEEN 50 AND 100


Question:
What are the average prices and cases of wines produced in the year of 2009 and made of Zinfandel grape?
Additional table information: table: wine_1

Answer: SELECT AVG(Price), AVG(Cases) FROM WINE WHERE YEAR = 2009 AND Grape = 'Zinfandel'


Question:
Give the average price and case of wines made from Zinfandel grapes in the year 2009.
Additional table information: table: wine_1

Answer: SELECT AVG(Price), AVG(Cases) FROM WINE WHERE YEAR = 2009 AND Grape = 'Zinfandel'


Question:
What are the maximum price and score of wines produced by St. Helena appelation?
Additional table information: table: wine_1

Answer: SELECT MAX(Price), MAX(Score) FROM WINE WHERE Appelation = 'St. Helena'


Question:
Give the maximum price and score for wines produced in the appelation St. Helena.
Additional table information: table: wine_1

Answer: SELECT MAX(Price), MAX(Score) FROM WINE WHERE Appelation = 'St. Helena'


Question:
What are the maximum price and score of wines in each year?
Additional table information: table: wine_1

Answer: SELECT MAX(Price), MAX(Score), YEAR FROM WINE GROUP BY YEAR


Question:
What are the maximum price and score of wines for each year?
Additional table information: table: wine_1

Answer: SELECT MAX(Price), MAX(Score), YEAR FROM WINE GROUP BY YEAR


Question:
What are the average price and score of wines grouped by appelation?
Additional table information: table: wine_1

Answer: SELECT AVG(Price), AVG(Score), Appelation FROM WINE GROUP BY Appelation


Question:
What are the average price and score of wines for each appelation?
Additional table information: table: wine_1

Answer: SELECT AVG(Price), AVG(Score), Appelation FROM WINE GROUP BY Appelation


Question:
Find the wineries that have at least four wines.
Additional table information: table: wine_1

Answer: SELECT Winery FROM WINE GROUP BY Winery HAVING COUNT(*) >= 4


Question:
Which wineries produce at least four wines?
Additional table information: table: wine_1

Answer: SELECT Winery FROM WINE GROUP BY Winery HAVING COUNT(*) >= 4


Question:
Find the country of all appelations who have at most three wines.
Additional table information: table: wine_1

Answer: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING COUNT(*) <= 3


Question:
What are the countries for appelations with at most 3 wines?
Additional table information: table: wine_1

Answer: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation GROUP BY T2.Appelation HAVING COUNT(*) <= 3


Question:
What are the names of wines whose production year are before the year of all wines by Brander winery?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE YEAR < (SELECT MIN(YEAR) FROM WINE WHERE Winery = 'Brander')


Question:
What are the names of wines produced before any wine from the Brander winery?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE YEAR < (SELECT MIN(YEAR) FROM WINE WHERE Winery = 'Brander')


Question:
What are the names of wines that are more expensive then all wines made in the year 2006?
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE Price > (SELECT MAX(Price) FROM WINE WHERE YEAR = 2006)


Question:
Give the names of wines with prices above any wine produced in 2006.
Additional table information: table: wine_1

Answer: SELECT Name FROM WINE WHERE Price > (SELECT MAX(Price) FROM WINE WHERE YEAR = 2006)


Question:
Find the top 3 wineries with the greatest number of wines made of white color grapes.
Additional table information: table: wine_1

Answer: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE = T2.GRAPE WHERE T1.Color = 'White' GROUP BY T2.Winery ORDER BY COUNT(*) DESC LIMIT 3


Question:
Which 3 wineries produce the most wines made from white grapes?
Additional table information: table: wine_1

Answer: SELECT T2.Winery FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.GRAPE = T2.GRAPE WHERE T1.Color = 'White' GROUP BY T2.Winery ORDER BY COUNT(*) DESC LIMIT 3


Question:
List the grape, winery and year of the wines whose price is bigger than 100 ordered by year.
Additional table information: table: wine_1

Answer: SELECT Grape, Winery, YEAR FROM WINE WHERE Price > 100 ORDER BY YEAR NULLS FIRST


Question:
What are the grapes, wineries and years for wines with price higher than 100, sorted by year?
Additional table information: table: wine_1

Answer: SELECT Grape, Winery, YEAR FROM WINE WHERE Price > 100 ORDER BY YEAR NULLS FIRST


Question:
List the grape, appelation and name of wines whose score is higher than 93 ordered by Name.
Additional table information: table: wine_1

Answer: SELECT Grape, Appelation, Name FROM WINE WHERE Score > 93 ORDER BY Name NULLS FIRST


Question:
What are the grapes, appelations, and wines with scores above 93, sorted by Name?
Additional table information: table: wine_1

Answer: SELECT Grape, Appelation, Name FROM WINE WHERE Score > 93 ORDER BY Name NULLS FIRST


Question:
Find the appelations that produce wines after the year of 2008 but not in Central Coast area.
Additional table information: table: wine_1

Answer: SELECT Appelation FROM WINE WHERE YEAR > 2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area = 'Central Coast'


Question:
What are the appelations for wines produced after 2008 but not in the Central Coast area?
Additional table information: table: wine_1

Answer: SELECT Appelation FROM WINE WHERE YEAR > 2008 EXCEPT SELECT Appelation FROM APPELLATIONS WHERE Area = 'Central Coast'


Question:
Find the average price of wines that are not produced from Sonoma county.
Additional table information: table: wine_1

Answer: SELECT AVG(price) FROM wine WHERE NOT Appelation IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma')


Question:
What is the average price for wines not produced in Sonoma county?
Additional table information: table: wine_1

Answer: SELECT AVG(price) FROM wine WHERE NOT Appelation IN (SELECT T1.Appelation FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.County = 'Sonoma')


Question:
Find the county where produces the most number of wines with score higher than 90.
Additional table information: table: wine_1

Answer: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T2.Score > 90 GROUP BY T1.County ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the county that produces the most wines scoring higher than 90?
Additional table information: table: wine_1

Answer: SELECT T1.County FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T2.Score > 90 GROUP BY T1.County ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many train stations are there?
Additional table information: table: train_station

Answer: SELECT COUNT(*) FROM station


Question:
Show the name, location, and number of platforms for all stations.
Additional table information: table: train_station

Answer: SELECT name, LOCATION, number_of_platforms FROM station


Question:
What are all locations of train stations?
Additional table information: table: train_station

Answer: SELECT DISTINCT LOCATION FROM station


Question:
Show the names and total passengers for all train stations not in London.
Additional table information: table: train_station

Answer: SELECT name, total_passengers FROM station WHERE LOCATION <> 'London'


Question:
Show the names and main services for train stations that have the top three total number of passengers.
Additional table information: table: train_station

Answer: SELECT name, main_services FROM station ORDER BY total_passengers DESC LIMIT 3


Question:
What is the average and maximum number of total passengers for train stations in London or Glasgow?
Additional table information: table: train_station

Answer: SELECT AVG(total_passengers), MAX(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'


Question:
Show all locations and the total number of platforms and passengers for all train stations in each location.
Additional table information: table: train_station

Answer: SELECT LOCATION, SUM(number_of_platforms), SUM(total_passengers) FROM station GROUP BY LOCATION


Question:
Show all locations that have train stations with at least 15 platforms and train stations with more than 25 total passengers.
Additional table information: table: train_station

Answer: SELECT DISTINCT LOCATION FROM station WHERE number_of_platforms >= 15 AND total_passengers > 25


Question:
Show all locations which don't have a train station with at least 15 platforms.
Additional table information: table: train_station

Answer: SELECT LOCATION FROM station EXCEPT SELECT LOCATION FROM station WHERE number_of_platforms >= 15


Question:
Show the location with most number of train stations.
Additional table information: table: train_station

Answer: SELECT LOCATION FROM station GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the name, time, and service for all trains.
Additional table information: table: train_station

Answer: SELECT name, TIME, service FROM train


Question:
Show the number of trains
Additional table information: table: train_station

Answer: SELECT COUNT(*) FROM train


Question:
Show the name and service for all trains in order by time.
Additional table information: table: train_station

Answer: SELECT name, service FROM train ORDER BY TIME NULLS FIRST


Question:
Show the station name and number of trains in each station.
Additional table information: table: train_station

Answer: SELECT T2.name, COUNT(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id


Question:
show the train name and station name for each train.
Additional table information: table: train_station

Answer: SELECT T2.name, T3.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id


Question:
Show all train names and times in stations in London in descending order by train time.
Additional table information: table: train_station

Answer: SELECT T3.name, T3.time FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T2.location = 'London' ORDER BY T3.time DESC


Question:
Show the station name with greatest number of trains.
Additional table information: table: train_station

Answer: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the station name with at least two trains.
Additional table information: table: train_station

Answer: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING COUNT(*) >= 2


Question:
Show all locations with only 1 station.
Additional table information: table: train_station

Answer: SELECT LOCATION FROM station GROUP BY LOCATION HAVING COUNT(*) = 1


Question:
Show station names without any trains.
Additional table information: table: train_station

Answer: SELECT name FROM station WHERE NOT station_id IN (SELECT station_id FROM train_station)


Question:
What are the names of the stations which serve both 'Ananthapuri Express' and 'Guruvayur Express' trains?
Additional table information: table: train_station

Answer: SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = 'Ananthapuri Express' INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = 'Guruvayur Express'


Question:
Find the names of the trains that do not pass any station located in London.
Additional table information: table: train_station

Answer: SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE NOT T1.station_id IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = 'London')


Question:
List the names and locations of all stations ordered by their yearly entry exit and interchange amounts.
Additional table information: table: train_station

Answer: SELECT name, LOCATION FROM station ORDER BY Annual_entry_exit NULLS FIRST, Annual_interchanges NULLS FIRST


Question:
List all vehicle id
Additional table information: table: driving_school

Answer: SELECT vehicle_id FROM Vehicles


Question:
What are the ids of all vehicles?
Additional table information: table: driving_school

Answer: SELECT vehicle_id FROM Vehicles


Question:
How many vehicle in total?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Vehicles


Question:
How many vehicles exist?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Vehicles


Question:
Show the detail of vehicle with id 1.
Additional table information: table: driving_school

Answer: SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1


Question:
What are the details of the car with id 1?
Additional table information: table: driving_school

Answer: SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1


Question:
List the first name middle name and last name of all staff.
Additional table information: table: driving_school

Answer: SELECT first_name, middle_name, last_name FROM Staff


Question:
What are the first, middle, and last names of all staff?
Additional table information: table: driving_school

Answer: SELECT first_name, middle_name, last_name FROM Staff


Question:
What is the birthday of the staff member with first name as Janessa and last name as Sawayn?
Additional table information: table: driving_school

Answer: SELECT date_of_birth FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
What is the date of birth for the staff member named Janessa Sawayn?
Additional table information: table: driving_school

Answer: SELECT date_of_birth FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
When did the staff member with first name as Janessa and last name as Sawayn join the company?
Additional table information: table: driving_school

Answer: SELECT date_joined_staff FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
When did the staff member named Janessa Sawayn join the company?
Additional table information: table: driving_school

Answer: SELECT date_joined_staff FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
When did the staff member with first name as Janessa and last name as Sawayn leave the company?
Additional table information: table: driving_school

Answer: SELECT date_left_staff FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
When did the staff member Janessa Sawayn leave the company?
Additional table information: table: driving_school

Answer: SELECT date_left_staff FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
How many staff have the first name Ludie?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Staff WHERE first_name = 'Ludie'


Question:
How many employees have a first name of Ludie?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Staff WHERE first_name = 'Ludie'


Question:
What is the nickname of staff with first name as Janessa and last name as Sawayn?
Additional table information: table: driving_school

Answer: SELECT nickname FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
What is the nickname of the employee named Janessa Sawayn?
Additional table information: table: driving_school

Answer: SELECT nickname FROM Staff WHERE first_name = 'Janessa' AND last_name = 'Sawayn'


Question:
How many staff in total?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Staff


Question:
How many employees are there?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Staff


Question:
Which city does staff with first name as Janessa and last name as Sawayn live?
Additional table information: table: driving_school

Answer: SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
In what city does Janessa Sawayn live?
Additional table information: table: driving_school

Answer: SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
Which country and state does staff with first name as Janessa and last name as Sawayn lived?
Additional table information: table: driving_school

Answer: SELECT T1.country, T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
In which country and state does Janessa Sawayn live?
Additional table information: table: driving_school

Answer: SELECT T1.country, T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
How long is the total lesson time took by customer with first name as Rylan and last name as Goodwin?
Additional table information: table: driving_school

Answer: SELECT SUM(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin'


Question:
How long is the total lesson time took by the customer named Rylan Goodwin?
Additional table information: table: driving_school

Answer: SELECT SUM(T1.lesson_time) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin'


Question:
What is the zip code of staff with first name as Janessa and last name as Sawayn lived?
Additional table information: table: driving_school

Answer: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
What is the zip code of the hosue of the employee named Janessa Sawayn?
Additional table information: table: driving_school

Answer: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
How many staff live in state Georgia?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Addresses WHERE state_province_county = 'Georgia'


Question:
How many employees live in Georgia?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Addresses WHERE state_province_county = 'Georgia'


Question:
Find out the first name and last name of staff lived in city Damianfort.
Additional table information: table: driving_school

Answer: SELECT T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = 'Damianfort'


Question:
What is the first and last name of all employees who live in the city Damianfort?
Additional table information: table: driving_school

Answer: SELECT T2.first_name, T2.last_name FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T1.city = 'Damianfort'


Question:
Which city lives most of staffs? List the city name and number of staffs.
Additional table information: table: driving_school

Answer: SELECT T1.city, COUNT(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY COUNT(*) DESC LIMIT 1


Question:
In which city do the most employees live and how many of them live there?
Additional table information: table: driving_school

Answer: SELECT T1.city, COUNT(*) FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.city ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the states which have between 2 to 4 staffs living there.
Additional table information: table: driving_school

Answer: SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING COUNT(*) BETWEEN 2 AND 4


Question:
What are the names of the states that have 2 to 4 employees living there?
Additional table information: table: driving_school

Answer: SELECT T1.state_province_county FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id GROUP BY T1.state_province_county HAVING COUNT(*) BETWEEN 2 AND 4


Question:
List the first name and last name of all customers.
Additional table information: table: driving_school

Answer: SELECT first_name, last_name FROM Customers


Question:
What are the first and last names for all customers?
Additional table information: table: driving_school

Answer: SELECT first_name, last_name FROM Customers


Question:
List email address and birthday of customer whose first name as Carole.
Additional table information: table: driving_school

Answer: SELECT email_address, date_of_birth FROM Customers WHERE first_name = 'Carole'


Question:
What are the email addresses and date of births for all customers who have a first name of Carole?
Additional table information: table: driving_school

Answer: SELECT email_address, date_of_birth FROM Customers WHERE first_name = 'Carole'


Question:
List phone number and email address of customer with more than 2000 outstanding balance.
Additional table information: table: driving_school

Answer: SELECT phone_number, email_address FROM Customers WHERE amount_outstanding > 2000


Question:
What are the phone numbers and email addresses of all customers who have an outstanding balance of more than 2000?
Additional table information: table: driving_school

Answer: SELECT phone_number, email_address FROM Customers WHERE amount_outstanding > 2000


Question:
What is the status code, mobile phone number and email address of customer with last name as Kohler or first name as Marina?
Additional table information: table: driving_school

Answer: SELECT customer_status_code, cell_mobile_phone_number, email_address FROM Customers WHERE first_name = 'Marina' OR last_name = 'Kohler'


Question:
What is the status code, phone number, and email address of the customer whose last name is Kohler or whose first name is Marina?
Additional table information: table: driving_school

Answer: SELECT customer_status_code, cell_mobile_phone_number, email_address FROM Customers WHERE first_name = 'Marina' OR last_name = 'Kohler'


Question:
When are the birthdays of customer who are classified as 'Good Customer' status?
Additional table information: table: driving_school

Answer: SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer'


Question:
What is the date of birth of every customer whose status code is 'Good Customer'?
Additional table information: table: driving_school

Answer: SELECT date_of_birth FROM Customers WHERE customer_status_code = 'Good Customer'


Question:
When did customer with first name as Carole and last name as Bernhard became a customer?
Additional table information: table: driving_school

Answer: SELECT date_became_customer FROM Customers WHERE first_name = 'Carole' AND last_name = 'Bernhard'


Question:
When did Carole Bernhard first become a customer?
Additional table information: table: driving_school

Answer: SELECT date_became_customer FROM Customers WHERE first_name = 'Carole' AND last_name = 'Bernhard'


Question:
How many customers in total?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Customers


Question:
How many customers are there?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Customers


Question:
List all customer status codes and the number of customers having each status code.
Additional table information: table: driving_school

Answer: SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code


Question:
For each customer status code, how many customers are classified that way?
Additional table information: table: driving_school

Answer: SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code


Question:
Which customer status code has least number of customers?
Additional table information: table: driving_school

Answer: SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
What is the status code with the least number of customers?
Additional table information: table: driving_school

Answer: SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin' AND T1.lesson_status_code = 'Completed'


Question:
How many lessons did the customer Ryan Goodwin complete?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Rylan' AND T2.last_name = 'Goodwin' AND T1.lesson_status_code = 'Completed'


Question:
What is maximum, minimum and average amount of outstanding of customer?
Additional table information: table: driving_school

Answer: SELECT MAX(amount_outstanding), MIN(amount_outstanding), AVG(amount_outstanding) FROM Customers


Question:
What is the maximum, minimum, and average amount of money outsanding for all customers?
Additional table information: table: driving_school

Answer: SELECT MAX(amount_outstanding), MIN(amount_outstanding), AVG(amount_outstanding) FROM Customers


Question:
List the first name and last name of customers have the amount of outstanding between 1000 and 3000.
Additional table information: table: driving_school

Answer: SELECT first_name, last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000


Question:
What are the first and last names of all customers with between 1000 and 3000 dollars outstanding?
Additional table information: table: driving_school

Answer: SELECT first_name, last_name FROM Customers WHERE amount_outstanding BETWEEN 1000 AND 3000


Question:
List first name and last name of customers lived in city Lockmanfurt.
Additional table information: table: driving_school

Answer: SELECT T1.first_name, T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = 'Lockmanfurt'


Question:
What are the first and last names of all customers who lived in Lockmanfurt?
Additional table information: table: driving_school

Answer: SELECT T1.first_name, T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = 'Lockmanfurt'


Question:
Which country does customer with first name as Carole and last name as Bernhard lived in?
Additional table information: table: driving_school

Answer: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'


Question:
What is the country in which the customer Carole Bernhard lived?
Additional table information: table: driving_school

Answer: SELECT T2.country FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'


Question:
What is zip code of customer with first name as Carole and last name as Bernhard?
Additional table information: table: driving_school

Answer: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'


Question:
What is the zip code of the customer Carole Bernhard?
Additional table information: table: driving_school

Answer: SELECT T2.zip_postcode FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T1.first_name = 'Carole' AND T1.last_name = 'Bernhard'


Question:
Which city does has most number of customers?
Additional table information: table: driving_school

Answer: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC LIMIT 1


Question:
What is the city with the most customers?
Additional table information: table: driving_school

Answer: SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY COUNT(*) DESC LIMIT 1


Question:
How much in total does customer with first name as Carole and last name as Bernhard paid?
Additional table information: table: driving_school

Answer: SELECT SUM(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Carole' AND T2.last_name = 'Bernhard'


Question:
What is the total amount of moeny paid by the customer Carole Bernhard?
Additional table information: table: driving_school

Answer: SELECT SUM(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Carole' AND T2.last_name = 'Bernhard'


Question:
List the number of customers that did not have any payment history.
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Customer_Payments)


Question:
How many customers have no payment histories?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Customers WHERE NOT customer_id IN (SELECT customer_id FROM Customer_Payments)


Question:
List first name and last name of customers that have more than 2 payments.
Additional table information: table: driving_school

Answer: SELECT T2.first_name, T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 2


Question:
What are the first and last names of all customers with more than 2 payments?
Additional table information: table: driving_school

Answer: SELECT T2.first_name, T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING COUNT(*) > 2


Question:
List all payment methods and number of payments using each payment methods.
Additional table information: table: driving_school

Answer: SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code


Question:
For each payment method, how many payments were made?
Additional table information: table: driving_school

Answer: SELECT payment_method_code, COUNT(*) FROM Customer_Payments GROUP BY payment_method_code


Question:
How many lessons were in cancelled state?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons WHERE lesson_status_code = 'Cancelled'


Question:
How many lessons have been cancelled?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons WHERE lesson_status_code = 'Cancelled'


Question:
List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'.
Additional table information: table: driving_school

Answer: SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn' AND nickname LIKE '%s%'


Question:
What are the the lesson ids of all staff taught by Janessa Sawayn whose nickname has the letter s?
Additional table information: table: driving_school

Answer: SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn' AND nickname LIKE '%s%'


Question:
How many lessons taught by staff whose first name has letter 'a' in it?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE '%a%'


Question:
How many lessons were taught by a staff member whose first name has the letter 'a' in it?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE '%a%'


Question:
How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn?
Additional table information: table: driving_school

Answer: SELECT SUM(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
What is the total time for all lessons taught by Janessa Sawayn?
Additional table information: table: driving_school

Answer: SELECT SUM(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
What is average lesson price taught by staff with first name as Janessa and last name as Sawayn?
Additional table information: table: driving_school

Answer: SELECT AVG(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
What is the average price for a lesson taught by Janessa Sawayn?
Additional table information: table: driving_school

Answer: SELECT AVG(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Janessa' AND T2.last_name = 'Sawayn'


Question:
How many lesson does customer with first name Ray took?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Ray'


Question:
How many lessons did the customer with the first name Ray take?
Additional table information: table: driving_school

Answer: SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Ray'


Question:
Which last names are both used by customers and by staff?
Additional table information: table: driving_school

Answer: SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff


Question:
What are the last names that are used by customers and staff?
Additional table information: table: driving_school

Answer: SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff


Question:
What is the first name of the staff who did not give any lesson?
Additional table information: table: driving_school

Answer: SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id


Question:
What is the first name of all employees who do not give any lessons?
Additional table information: table: driving_school

Answer: SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id


Question:
What is the id and detail of the vehicle used in lessons for most of the times?
Additional table information: table: driving_school

Answer: SELECT T1.vehicle_id, T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id = T2.vehicle_id GROUP BY T1.vehicle_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
How many faculty do we have?
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty


Question:
What is the total number of faculty members?
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty


Question:
What ranks do we have for faculty?
Additional table information: table: activity_1

Answer: SELECT DISTINCT rank FROM Faculty


Question:
Find the list of distinct ranks for faculty.
Additional table information: table: activity_1

Answer: SELECT DISTINCT rank FROM Faculty


Question:
Show all the distinct buildings that have faculty rooms.
Additional table information: table: activity_1

Answer: SELECT DISTINCT building FROM Faculty


Question:
What buildings have faculty offices?
Additional table information: table: activity_1

Answer: SELECT DISTINCT building FROM Faculty


Question:
Show the rank, first name, and last name for all the faculty.
Additional table information: table: activity_1

Answer: SELECT rank, Fname, Lname FROM Faculty


Question:
What are the rank, first name, and last name of the faculty members?
Additional table information: table: activity_1

Answer: SELECT rank, Fname, Lname FROM Faculty


Question:
Show the first name, last name, and phone number for all female faculty members.
Additional table information: table: activity_1

Answer: SELECT Fname, Lname, phone FROM Faculty WHERE Sex = 'F'


Question:
What are the first name, last name, and phone number of all the female faculty members?
Additional table information: table: activity_1

Answer: SELECT Fname, Lname, phone FROM Faculty WHERE Sex = 'F'


Question:
Show ids for all the male faculty.
Additional table information: table: activity_1

Answer: SELECT FacID FROM Faculty WHERE Sex = 'M'


Question:
What are the faculty ids of all the male faculty members?
Additional table information: table: activity_1

Answer: SELECT FacID FROM Faculty WHERE Sex = 'M'


Question:
How many female Professors do we have?
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty WHERE Sex = 'F' AND Rank = 'Professor'


Question:
Count the number of female Professors we have.
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty WHERE Sex = 'F' AND Rank = 'Professor'


Question:
Show the phone, room, and building for the faculty named Jerry Prince.
Additional table information: table: activity_1

Answer: SELECT phone, room, building FROM Faculty WHERE Fname = 'Jerry' AND Lname = 'Prince'


Question:
What are the phone, room, and building of the faculty member called Jerry Prince?
Additional table information: table: activity_1

Answer: SELECT phone, room, building FROM Faculty WHERE Fname = 'Jerry' AND Lname = 'Prince'


Question:
How many Professors are in building NEB?
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty WHERE Rank = 'Professor' AND building = 'NEB'


Question:
Count the number of Professors who have office in building NEB.
Additional table information: table: activity_1

Answer: SELECT COUNT(*) FROM Faculty WHERE Rank = 'Professor' AND building = 'NEB'


Question:
Show the first name and last name for all the instructors.
Additional table information: table: activity_1

Answer: SELECT fname, lname FROM Faculty WHERE Rank = 'Instructor'


Question:
What are the first name and last name of all the instructors?
Additional table information: table: activity_1

Answer: SELECT fname, lname FROM Faculty WHERE Rank = 'Instructor'


Question:
Show all the buildings along with the number of faculty members the buildings have.
Additional table information: table: activity_1

Answer: SELECT building, COUNT(*) FROM Faculty GROUP BY building


Question:
How many faculty members does each building have? List the result with the name of the building.
Additional table information: table: activity_1

Answer: SELECT building, COUNT(*) FROM Faculty GROUP BY building


Question:
Which building has most faculty members?
Additional table information: table: activity_1

Answer: SELECT building FROM Faculty GROUP BY building ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the building that has the largest number of faculty members.
Additional table information: table: activity_1

Answer: SELECT building FROM Faculty GROUP BY building ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show all the buildings that have at least 10 professors.
Additional table information: table: activity_1

Answer: SELECT building FROM Faculty WHERE rank = 'Professor' GROUP BY building HAVING COUNT(*) >= 10


Question:
In which buildings are there at least ten professors?
Additional table information: table: activity_1

Answer: SELECT building FROM Faculty WHERE rank = 'Professor' GROUP BY building HAVING COUNT(*) >= 10


Question:
For each faculty rank, show the number of faculty members who have it.
Additional table information: table: activity_1

Answer: SELECT rank, COUNT(*) FROM Faculty GROUP BY rank


Question:
How many faculty members do we have for each faculty rank?
Additional table information: table: activity_1

Answer: SELECT rank, COUNT(*) FROM Faculty GROUP BY rank


Question:
Show all the ranks and the number of male and female faculty for each rank.
Additional table information: table: activity_1

Answer: SELECT rank, sex, COUNT(*) FROM Faculty GROUP BY rank, sex


Question:
How many faculty members do we have for each rank and gender?
Additional table information: table: activity_1

Answer: SELECT rank, sex, COUNT(*) FROM Faculty GROUP BY rank, sex


Question:
Which rank has the smallest number of faculty members?
Additional table information: table: activity_1

Answer: SELECT rank FROM Faculty GROUP BY rank ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Find the faculty rank that has the least members.
Additional table information: table: activity_1

Answer: SELECT rank FROM Faculty GROUP BY rank ORDER BY COUNT(*) ASC NULLS FIRST LIMIT 1


Question:
Show the number of male and female assistant professors.
Additional table information: table: activity_1

Answer: SELECT sex, COUNT(*) FROM Faculty WHERE rank = 'AsstProf' GROUP BY sex


Question:
How many male and female assistant professors do we have?
Additional table information: table: activity_1

Answer: SELECT sex, COUNT(*) FROM Faculty WHERE rank = 'AsstProf' GROUP BY sex


Question:
What are the first name and last name of Linda Smith's advisor?
Additional table information: table: activity_1

Answer: SELECT T1.fname, T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = 'Linda' AND T2.lname = 'Smith'


Question:
Who is the advisor of Linda Smith? Give me the first name and last name.
Additional table information: table: activity_1

Answer: SELECT T1.fname, T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = 'Linda' AND T2.lname = 'Smith'


Question:
Show the ids of students whose advisors are professors.
Additional table information: table: activity_1

Answer: SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = 'Professor'


Question:
Which students have professors as their advisors? Find their student ids.
Additional table information: table: activity_1

Answer: SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = 'Professor'