question
stringlengths 12
244
| context
stringlengths 27
489
| answer
stringlengths 18
557
| text
stringlengths 114
1.06k
|
---|---|---|---|
Show the name of drivers in descending order of age.
|
CREATE TABLE driver (name VARCHAR, age VARCHAR)
|
SELECT name FROM driver ORDER BY age DESC
|
### Context: CREATE TABLE driver (name VARCHAR, age VARCHAR) ### Question: Show the name of drivers in descending order of age. ### Answer: SELECT name FROM driver ORDER BY age DESC
|
Show all different home cities.
|
CREATE TABLE driver (home_city VARCHAR)
|
SELECT DISTINCT home_city FROM driver
|
### Context: CREATE TABLE driver (home_city VARCHAR) ### Question: Show all different home cities. ### Answer: SELECT DISTINCT home_city FROM driver
|
Show the home city with the most number of drivers.
|
CREATE TABLE driver (home_city VARCHAR)
|
SELECT home_city FROM driver GROUP BY home_city ORDER BY COUNT(*) DESC LIMIT 1
|
### Context: CREATE TABLE driver (home_city VARCHAR) ### Question: Show the home city with the most number of drivers. ### Answer: SELECT home_city FROM driver GROUP BY home_city ORDER BY COUNT(*) DESC LIMIT 1
|
Show the party with drivers from Hartford and drivers older than 40.
|
CREATE TABLE driver (party VARCHAR, home_city VARCHAR, age VARCHAR)
|
SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40
|
### Context: CREATE TABLE driver (party VARCHAR, home_city VARCHAR, age VARCHAR) ### Question: Show the party with drivers from Hartford and drivers older than 40. ### Answer: SELECT party FROM driver WHERE home_city = 'Hartford' AND age > 40
|
Show home city where at least two drivers older than 40 are from.
|
CREATE TABLE driver (home_city VARCHAR, age INTEGER)
|
SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING COUNT(*) >= 2
|
### Context: CREATE TABLE driver (home_city VARCHAR, age INTEGER) ### Question: Show home city where at least two drivers older than 40 are from. ### Answer: SELECT home_city FROM driver WHERE age > 40 GROUP BY home_city HAVING COUNT(*) >= 2
|
Show all home cities except for those having a driver older than 40.
|
CREATE TABLE driver (home_city VARCHAR, age INTEGER)
|
SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40
|
### Context: CREATE TABLE driver (home_city VARCHAR, age INTEGER) ### Question: Show all home cities except for those having a driver older than 40. ### Answer: SELECT home_city FROM driver EXCEPT SELECT home_city FROM driver WHERE age > 40
|
Show the names of the drivers without a school bus.
|
CREATE TABLE school_bus (name VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)
|
SELECT name FROM driver WHERE NOT driver_id IN (SELECT driver_id FROM school_bus)
|
### Context: CREATE TABLE school_bus (name VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR) ### Question: Show the names of the drivers without a school bus. ### Answer: SELECT name FROM driver WHERE NOT driver_id IN (SELECT driver_id FROM school_bus)
|
Show the types of schools that have two schools.
|
CREATE TABLE school (TYPE VARCHAR)
|
SELECT TYPE FROM school GROUP BY TYPE HAVING COUNT(*) = 2
|
### Context: CREATE TABLE school (TYPE VARCHAR) ### Question: Show the types of schools that have two schools. ### Answer: SELECT TYPE FROM school GROUP BY TYPE HAVING COUNT(*) = 2
|
Show the school name and driver name for all school buses.
|
CREATE TABLE school (school VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)
|
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
|
### Context: CREATE TABLE school (school VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR) ### Question: Show the school name and driver name for all school buses. ### 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
|
What is the maximum, minimum and average years spent working on a school bus?
|
CREATE TABLE school_bus (years_working INTEGER)
|
SELECT MAX(years_working), MIN(years_working), AVG(years_working) FROM school_bus
|
### Context: CREATE TABLE school_bus (years_working INTEGER) ### Question: What is the maximum, minimum and average years spent working on a school bus? ### Answer: SELECT MAX(years_working), MIN(years_working), AVG(years_working) FROM school_bus
|
Show the school name and type for schools without a school bus.
|
CREATE TABLE school_bus (school VARCHAR, TYPE VARCHAR, school_id VARCHAR); CREATE TABLE school (school VARCHAR, TYPE VARCHAR, school_id VARCHAR)
|
SELECT school, TYPE FROM school WHERE NOT school_id IN (SELECT school_id FROM school_bus)
|
### Context: CREATE TABLE school_bus (school VARCHAR, TYPE VARCHAR, school_id VARCHAR); CREATE TABLE school (school VARCHAR, TYPE VARCHAR, school_id VARCHAR) ### Question: Show the school name and type for schools without a school bus. ### Answer: SELECT school, TYPE FROM school WHERE NOT school_id IN (SELECT school_id FROM school_bus)
|
Show the type of school and the number of buses for each type.
|
CREATE TABLE school (type VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id VARCHAR)
|
SELECT T2.type, COUNT(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.type
|
### Context: CREATE TABLE school (type VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id VARCHAR) ### Question: Show the type of school and the number of buses for each type. ### 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
|
How many drivers are from Hartford city or younger than 40?
|
CREATE TABLE driver (home_city VARCHAR, age VARCHAR)
|
SELECT COUNT(*) FROM driver WHERE home_city = 'Hartford' OR age < 40
|
### Context: CREATE TABLE driver (home_city VARCHAR, age VARCHAR) ### Question: How many drivers are from Hartford city or younger than 40? ### Answer: SELECT COUNT(*) FROM driver WHERE home_city = 'Hartford' OR age < 40
|
List names for drivers from Hartford city and younger than 40.
|
CREATE TABLE driver (name VARCHAR, home_city VARCHAR, age VARCHAR)
|
SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40
|
### Context: CREATE TABLE driver (name VARCHAR, home_city VARCHAR, age VARCHAR) ### Question: List names for drivers from Hartford city and younger than 40. ### Answer: SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40
|
find the name of driver who is driving the school bus with the longest working history.
|
CREATE TABLE school_bus (driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)
|
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
|
### Context: CREATE TABLE school_bus (driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR) ### Question: find the name of driver who is driving the school bus with the longest working history. ### 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
|
How many flights have a velocity larger than 200?
|
CREATE TABLE flight (velocity INTEGER)
|
SELECT COUNT(*) FROM flight WHERE velocity > 200
|
### Context: CREATE TABLE flight (velocity INTEGER) ### Question: How many flights have a velocity larger than 200? ### Answer: SELECT COUNT(*) FROM flight WHERE velocity > 200
|
List the vehicle flight number, date and pilot of all the flights, ordered by altitude.
|
CREATE TABLE flight (vehicle_flight_number VARCHAR, date VARCHAR, pilot VARCHAR, altitude VARCHAR)
|
SELECT vehicle_flight_number, date, pilot FROM flight ORDER BY altitude
|
### Context: CREATE TABLE flight (vehicle_flight_number VARCHAR, date VARCHAR, pilot VARCHAR, altitude VARCHAR) ### Question: List the vehicle flight number, date and pilot of all the flights, ordered by altitude. ### Answer: SELECT vehicle_flight_number, date, pilot FROM flight ORDER BY altitude
|
List the id, country, city and name of the airports ordered alphabetically by the name.
|
CREATE TABLE airport (id VARCHAR, country VARCHAR, city VARCHAR, name VARCHAR)
|
SELECT id, country, city, name FROM airport ORDER BY name
|
### Context: CREATE TABLE airport (id VARCHAR, country VARCHAR, city VARCHAR, name VARCHAR) ### Question: List the id, country, city and name of the airports ordered alphabetically by the name. ### Answer: SELECT id, country, city, name FROM airport ORDER BY name
|
What is maximum group equity shareholding of the companies?
|
CREATE TABLE operate_company (group_equity_shareholding INTEGER)
|
SELECT MAX(group_equity_shareholding) FROM operate_company
|
### Context: CREATE TABLE operate_company (group_equity_shareholding INTEGER) ### Question: What is maximum group equity shareholding of the companies? ### Answer: SELECT MAX(group_equity_shareholding) FROM operate_company
|
What is the velocity of the pilot named 'Thompson'?
|
CREATE TABLE flight (velocity INTEGER, pilot VARCHAR)
|
SELECT AVG(velocity) FROM flight WHERE pilot = 'Thompson'
|
### Context: CREATE TABLE flight (velocity INTEGER, pilot VARCHAR) ### Question: What is the velocity of the pilot named 'Thompson'? ### Answer: SELECT AVG(velocity) FROM flight WHERE pilot = 'Thompson'
|
What are the names and types of the companies that have ever operated a flight?
|
CREATE TABLE operate_company (name VARCHAR, type VARCHAR, id VARCHAR); CREATE TABLE flight (Id VARCHAR)
|
SELECT T1.name, T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id
|
### Context: CREATE TABLE operate_company (name VARCHAR, type VARCHAR, id VARCHAR); CREATE TABLE flight (Id VARCHAR) ### Question: What are the names and types of the companies that have ever operated a flight? ### Answer: SELECT T1.name, T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id
|
What are the names of the airports which are not in the country 'Iceland'?
|
CREATE TABLE airport (name VARCHAR, country VARCHAR)
|
SELECT name FROM airport WHERE country <> 'Iceland'
|
### Context: CREATE TABLE airport (name VARCHAR, country VARCHAR) ### Question: What are the names of the airports which are not in the country 'Iceland'? ### Answer: SELECT name FROM airport WHERE country <> 'Iceland'
|
What are the distinct types of the companies that have operated any flights with velocity less than 200?
|
CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (type VARCHAR, id VARCHAR)
|
SELECT DISTINCT T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T2.velocity < 200
|
### Context: CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (type VARCHAR, id VARCHAR) ### Question: What are the distinct types of the companies that have operated any flights with velocity less than 200? ### Answer: SELECT DISTINCT T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id WHERE T2.velocity < 200
|
What are the ids and names of the companies that operated more than one flight?
|
CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR, name VARCHAR)
|
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
|
### Context: CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR, name VARCHAR) ### Question: What are the ids and names of the companies that operated more than one flight? ### 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
|
What is the id, name and IATA code of the airport that had most number of flights?
|
CREATE TABLE airport (id VARCHAR, name VARCHAR, IATA VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR)
|
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
|
### Context: CREATE TABLE airport (id VARCHAR, name VARCHAR, IATA VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR) ### Question: What is the id, name and IATA code of the airport that had most number of flights? ### 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
|
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
|
CREATE TABLE airport (id VARCHAR, country VARCHAR, name VARCHAR); CREATE TABLE flight (pilot VARCHAR, airport_id VARCHAR)
|
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'
|
### Context: CREATE TABLE airport (id VARCHAR, country VARCHAR, name VARCHAR); CREATE TABLE flight (pilot VARCHAR, airport_id VARCHAR) ### Question: What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'? ### 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'
|
What is the most common company type, and how many are there?
|
CREATE TABLE operate_company (TYPE VARCHAR)
|
SELECT TYPE, COUNT(*) FROM operate_company GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
|
### Context: CREATE TABLE operate_company (TYPE VARCHAR) ### Question: What is the most common company type, and how many are there? ### Answer: SELECT TYPE, COUNT(*) FROM operate_company GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
|
How many airports haven't the pilot 'Thompson' driven an aircraft?
|
CREATE TABLE airport (id VARCHAR, airport_id VARCHAR, pilot VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR, pilot VARCHAR)
|
SELECT COUNT(*) FROM airport WHERE NOT id IN (SELECT airport_id FROM flight WHERE pilot = 'Thompson')
|
### Context: CREATE TABLE airport (id VARCHAR, airport_id VARCHAR, pilot VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR, pilot VARCHAR) ### Question: How many airports haven't the pilot 'Thompson' driven an aircraft? ### Answer: SELECT COUNT(*) FROM airport WHERE NOT id IN (SELECT airport_id FROM flight WHERE pilot = 'Thompson')
|
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.
|
CREATE TABLE operate_company (id VARCHAR, principal_activities VARCHAR); CREATE TABLE flight (Id VARCHAR)
|
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'
|
### Context: CREATE TABLE operate_company (id VARCHAR, principal_activities VARCHAR); CREATE TABLE flight (Id VARCHAR) ### 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. ### 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'
|
Which of the airport names contains the word 'international'?
|
CREATE TABLE airport (name VARCHAR)
|
SELECT name FROM airport WHERE name LIKE '%international%'
|
### Context: CREATE TABLE airport (name VARCHAR) ### Question: Which of the airport names contains the word 'international'? ### Answer: SELECT name FROM airport WHERE name LIKE '%international%'
|
How many companies operates airlines in each airport?
|
CREATE TABLE airport (id VARCHAR); CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR)
|
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
|
### Context: CREATE TABLE airport (id VARCHAR); CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR) ### Question: How many companies operates airlines in each airport? ### 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
|
how many airports are there in each country?
|
CREATE TABLE airport (country VARCHAR)
|
SELECT COUNT(*), country FROM airport GROUP BY country
|
### Context: CREATE TABLE airport (country VARCHAR) ### Question: how many airports are there in each country? ### Answer: SELECT COUNT(*), country FROM airport GROUP BY country
|
which countries have more than 2 airports?
|
CREATE TABLE airport (country VARCHAR)
|
SELECT country FROM airport GROUP BY country HAVING COUNT(*) > 2
|
### Context: CREATE TABLE airport (country VARCHAR) ### Question: which countries have more than 2 airports? ### Answer: SELECT country FROM airport GROUP BY country HAVING COUNT(*) > 2
|
which pilot is in charge of the most number of flights?
|
CREATE TABLE flight (pilot VARCHAR)
|
SELECT pilot FROM flight GROUP BY pilot ORDER BY COUNT(*) DESC LIMIT 1
|
### Context: CREATE TABLE flight (pilot VARCHAR) ### Question: which pilot is in charge of the most number of flights? ### Answer: SELECT pilot FROM flight GROUP BY pilot ORDER BY COUNT(*) DESC LIMIT 1
|
Show all account ids and account details.
|
CREATE TABLE Accounts (account_id VARCHAR, account_details VARCHAR)
|
SELECT account_id, account_details FROM Accounts
|
### Context: CREATE TABLE Accounts (account_id VARCHAR, account_details VARCHAR) ### Question: Show all account ids and account details. ### Answer: SELECT account_id, account_details FROM Accounts
|
How many statements do we have?
|
CREATE TABLE Statements (Id VARCHAR)
|
SELECT COUNT(*) FROM Statements
|
### Context: CREATE TABLE Statements (Id VARCHAR) ### Question: How many statements do we have? ### Answer: SELECT COUNT(*) FROM Statements
|
List all statement ids and statement details.
|
CREATE TABLE Statements (STATEMENT_ID VARCHAR, statement_details VARCHAR)
|
SELECT STATEMENT_ID, statement_details FROM Statements
|
### Context: CREATE TABLE Statements (STATEMENT_ID VARCHAR, statement_details VARCHAR) ### Question: List all statement ids and statement details. ### Answer: SELECT STATEMENT_ID, statement_details FROM Statements
|
Show statement id, statement detail, account detail for accounts.
|
CREATE TABLE Accounts (statement_id VARCHAR, account_details VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR)
|
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
|
### Context: CREATE TABLE Accounts (statement_id VARCHAR, account_details VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR) ### Question: Show statement id, statement detail, account detail for accounts. ### 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
|
Show all statement id and the number of accounts for each statement.
|
CREATE TABLE Accounts (STATEMENT_ID VARCHAR)
|
SELECT STATEMENT_ID, COUNT(*) FROM Accounts GROUP BY STATEMENT_ID
|
### Context: CREATE TABLE Accounts (STATEMENT_ID VARCHAR) ### Question: Show all statement id and the number of accounts for each statement. ### Answer: SELECT STATEMENT_ID, COUNT(*) FROM Accounts GROUP BY STATEMENT_ID
|
Show the statement id and the statement detail for the statement with most number of accounts.
|
CREATE TABLE Accounts (statement_id VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR)
|
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
|
### Context: CREATE TABLE Accounts (statement_id VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR) ### Question: Show the statement id and the statement detail for the statement with most number of accounts. ### 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
|
Show the number of documents.
|
CREATE TABLE Documents (Id VARCHAR)
|
SELECT COUNT(*) FROM Documents
|
### Context: CREATE TABLE Documents (Id VARCHAR) ### Question: Show the number of documents. ### Answer: SELECT COUNT(*) FROM Documents
|
List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'.
|
CREATE TABLE Documents (document_type_code VARCHAR, document_name VARCHAR, document_description VARCHAR)
|
SELECT document_type_code, document_name, document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'
|
### Context: CREATE TABLE Documents (document_type_code VARCHAR, document_name VARCHAR, document_description VARCHAR) ### Question: List the document type code, document name, and document description for the document with name 'Noel CV' or name 'King Book'. ### Answer: SELECT document_type_code, document_name, document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'
|
Show the ids and names of all documents.
|
CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR)
|
SELECT document_id, document_name FROM Documents
|
### Context: CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR) ### Question: Show the ids and names of all documents. ### Answer: SELECT document_id, document_name FROM Documents
|
Find names and ids of all documents with document type code BK.
|
CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR, document_type_code VARCHAR)
|
SELECT document_name, document_id FROM Documents WHERE document_type_code = "BK"
|
### Context: CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR, document_type_code VARCHAR) ### Question: Find names and ids of all documents with document type code BK. ### Answer: SELECT document_name, document_id FROM Documents WHERE document_type_code = "BK"
|
How many documents are with document type code BK for each product id?
|
CREATE TABLE Documents (project_id VARCHAR, document_type_code VARCHAR)
|
SELECT COUNT(*), project_id FROM Documents WHERE document_type_code = "BK" GROUP BY project_id
|
### Context: CREATE TABLE Documents (project_id VARCHAR, document_type_code VARCHAR) ### Question: How many documents are with document type code BK for each product id? ### Answer: SELECT COUNT(*), project_id FROM Documents WHERE document_type_code = "BK" GROUP BY project_id
|
Show the document name and the document date for all documents on project with details 'Graph Database project'.
|
CREATE TABLE Documents (project_id VARCHAR); CREATE TABLE projects (project_id VARCHAR, project_details VARCHAR)
|
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'
|
### Context: CREATE TABLE Documents (project_id VARCHAR); CREATE TABLE projects (project_id VARCHAR, project_details VARCHAR) ### Question: Show the document name and the document date for all documents on project with details 'Graph Database project'. ### 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'
|
Show project ids and the number of documents in each project.
|
CREATE TABLE Documents (project_id VARCHAR)
|
SELECT project_id, COUNT(*) FROM Documents GROUP BY project_id
|
### Context: CREATE TABLE Documents (project_id VARCHAR) ### Question: Show project ids and the number of documents in each project. ### Answer: SELECT project_id, COUNT(*) FROM Documents GROUP BY project_id
|
What is the id of the project with least number of documents?
|
CREATE TABLE Documents (project_id VARCHAR)
|
SELECT project_id FROM Documents GROUP BY project_id ORDER BY COUNT(*) LIMIT 1
|
### Context: CREATE TABLE Documents (project_id VARCHAR) ### Question: What is the id of the project with least number of documents? ### Answer: SELECT project_id FROM Documents GROUP BY project_id ORDER BY COUNT(*) LIMIT 1
|
Show the ids for projects with at least 2 documents.
|
CREATE TABLE Documents (project_id VARCHAR)
|
SELECT project_id FROM Documents GROUP BY project_id HAVING COUNT(*) >= 2
|
### Context: CREATE TABLE Documents (project_id VARCHAR) ### Question: Show the ids for projects with at least 2 documents. ### Answer: SELECT project_id FROM Documents GROUP BY project_id HAVING COUNT(*) >= 2
|
List document type codes and the number of documents in each code.
|
CREATE TABLE Documents (document_type_code VARCHAR)
|
SELECT document_type_code, COUNT(*) FROM Documents GROUP BY document_type_code
|
### Context: CREATE TABLE Documents (document_type_code VARCHAR) ### Question: List document type codes and the number of documents in each code. ### Answer: SELECT document_type_code, COUNT(*) FROM Documents GROUP BY document_type_code
|
What is the document type code with most number of documents?
|
CREATE TABLE Documents (document_type_code VARCHAR)
|
SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1
|
### Context: CREATE TABLE Documents (document_type_code VARCHAR) ### Question: What is the document type code with most number of documents? ### Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1
|
Show the document type code with fewer than 3 documents.
|
CREATE TABLE Documents (document_type_code VARCHAR)
|
SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING COUNT(*) < 3
|
### Context: CREATE TABLE Documents (document_type_code VARCHAR) ### Question: Show the document type code with fewer than 3 documents. ### Answer: SELECT document_type_code FROM Documents GROUP BY document_type_code HAVING COUNT(*) < 3
|
Show the statement detail and the corresponding document name for the statement with detail 'Private Project'.
|
CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR); CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR)
|
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'
|
### Context: CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR); CREATE TABLE Documents (document_name VARCHAR, document_id VARCHAR) ### Question: Show the statement detail and the corresponding document name for the statement with detail 'Private Project'. ### 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'
|
Show all document type codes, document type names, document type descriptions.
|
CREATE TABLE Ref_document_types (document_type_code VARCHAR, document_type_name VARCHAR, document_type_description VARCHAR)
|
SELECT document_type_code, document_type_name, document_type_description FROM Ref_document_types
|
### Context: CREATE TABLE Ref_document_types (document_type_code VARCHAR, document_type_name VARCHAR, document_type_description VARCHAR) ### Question: Show all document type codes, document type names, document type descriptions. ### Answer: SELECT document_type_code, document_type_name, document_type_description FROM Ref_document_types
|
What is the document type description for document type named Film?
|
CREATE TABLE Ref_document_types (document_type_description VARCHAR, document_type_name VARCHAR)
|
SELECT document_type_description FROM Ref_document_types WHERE document_type_name = "Film"
|
### Context: CREATE TABLE Ref_document_types (document_type_description VARCHAR, document_type_name VARCHAR) ### Question: What is the document type description for document type named Film? ### Answer: SELECT document_type_description FROM Ref_document_types WHERE document_type_name = "Film"
|
What is the document type name and the document type description and creation date for all the documents?
|
CREATE TABLE Ref_document_types (document_type_name VARCHAR, document_type_description VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (Document_date VARCHAR, document_type_code VARCHAR)
|
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
|
### Context: CREATE TABLE Ref_document_types (document_type_name VARCHAR, document_type_description VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (Document_date VARCHAR, document_type_code VARCHAR) ### Question: What is the document type name and the document type description and creation date for all the documents? ### 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
|
Show the number of projects.
|
CREATE TABLE Projects (Id VARCHAR)
|
SELECT COUNT(*) FROM Projects
|
### Context: CREATE TABLE Projects (Id VARCHAR) ### Question: Show the number of projects. ### Answer: SELECT COUNT(*) FROM Projects
|
List ids and details for all projects.
|
CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR)
|
SELECT project_id, project_details FROM Projects
|
### Context: CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR) ### Question: List ids and details for all projects. ### Answer: SELECT project_id, project_details FROM Projects
|
What is the project id and detail for the project with at least two documents?
|
CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR); CREATE TABLE Documents (project_id VARCHAR)
|
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
|
### Context: CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR); CREATE TABLE Documents (project_id VARCHAR) ### Question: What is the project id and detail for the project with at least two documents? ### 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
|
What is the project detail for the project with document "King Book"?
|
CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR); CREATE TABLE Documents (project_id VARCHAR, document_name VARCHAR)
|
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"
|
### Context: CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR); CREATE TABLE Documents (project_id VARCHAR, document_name VARCHAR) ### Question: What is the project detail for the project with document "King Book"? ### 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"
|
How many budget types do we have?
|
CREATE TABLE Ref_budget_codes (Id VARCHAR)
|
SELECT COUNT(*) FROM Ref_budget_codes
|
### Context: CREATE TABLE Ref_budget_codes (Id VARCHAR) ### Question: How many budget types do we have? ### Answer: SELECT COUNT(*) FROM Ref_budget_codes
|
List all budget type codes and descriptions.
|
CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR, budget_type_description VARCHAR)
|
SELECT budget_type_code, budget_type_description FROM Ref_budget_codes
|
### Context: CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR, budget_type_description VARCHAR) ### Question: List all budget type codes and descriptions. ### Answer: SELECT budget_type_code, budget_type_description FROM Ref_budget_codes
|
What is the description for the budget type with code ORG?
|
CREATE TABLE Ref_budget_codes (budget_type_description VARCHAR, budget_type_code VARCHAR)
|
SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = "ORG"
|
### Context: CREATE TABLE Ref_budget_codes (budget_type_description VARCHAR, budget_type_code VARCHAR) ### Question: What is the description for the budget type with code ORG? ### Answer: SELECT budget_type_description FROM Ref_budget_codes WHERE budget_type_code = "ORG"
|
How many documents have expenses?
|
CREATE TABLE Documents_with_expenses (Id VARCHAR)
|
SELECT COUNT(*) FROM Documents_with_expenses
|
### Context: CREATE TABLE Documents_with_expenses (Id VARCHAR) ### Question: How many documents have expenses? ### Answer: SELECT COUNT(*) FROM Documents_with_expenses
|
What are the document ids for the budget type code 'SF'?
|
CREATE TABLE Documents_with_expenses (document_id VARCHAR, budget_type_code VARCHAR)
|
SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'
|
### Context: CREATE TABLE Documents_with_expenses (document_id VARCHAR, budget_type_code VARCHAR) ### Question: What are the document ids for the budget type code 'SF'? ### Answer: SELECT document_id FROM Documents_with_expenses WHERE budget_type_code = 'SF'
|
Show the budget type code and description and the corresponding document id.
|
CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR, budget_type_description VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR, budget_type_code VARCHAR)
|
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
|
### Context: CREATE TABLE Ref_budget_codes (budget_type_code VARCHAR, budget_type_description VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR, budget_type_code VARCHAR) ### Question: Show the budget type code and description and the corresponding document id. ### 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
|
Show ids for all documents with budget types described as 'Government'.
|
CREATE TABLE Documents_with_expenses (document_id VARCHAR, Budget_Type_code VARCHAR); CREATE TABLE Ref_Budget_Codes (Budget_Type_code VARCHAR, budget_type_Description VARCHAR)
|
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"
|
### Context: CREATE TABLE Documents_with_expenses (document_id VARCHAR, Budget_Type_code VARCHAR); CREATE TABLE Ref_Budget_Codes (Budget_Type_code VARCHAR, budget_type_Description VARCHAR) ### Question: Show ids for all documents with budget types described as 'Government'. ### 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"
|
Show budget type codes and the number of documents in each budget type.
|
CREATE TABLE Documents_with_expenses (budget_type_code VARCHAR)
|
SELECT budget_type_code, COUNT(*) FROM Documents_with_expenses GROUP BY budget_type_code
|
### Context: CREATE TABLE Documents_with_expenses (budget_type_code VARCHAR) ### Question: Show budget type codes and the number of documents in each budget type. ### Answer: SELECT budget_type_code, COUNT(*) FROM Documents_with_expenses GROUP BY budget_type_code
|
What is the budget type code with most number of documents.
|
CREATE TABLE Documents_with_expenses (budget_type_code VARCHAR)
|
SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY COUNT(*) DESC LIMIT 1
|
### Context: CREATE TABLE Documents_with_expenses (budget_type_code VARCHAR) ### Question: What is the budget type code with most number of documents. ### Answer: SELECT budget_type_code FROM Documents_with_expenses GROUP BY budget_type_code ORDER BY COUNT(*) DESC LIMIT 1
|
What are the ids of documents which don't have expense budgets?
|
CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR)
|
SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses
|
### Context: CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR) ### Question: What are the ids of documents which don't have expense budgets? ### Answer: SELECT document_id FROM Documents EXCEPT SELECT document_id FROM Documents_with_expenses
|
Show ids for all documents in type CV without expense budgets.
|
CREATE TABLE Documents_with_expenses (document_id VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_type_code VARCHAR)
|
SELECT document_id FROM Documents WHERE document_type_code = "CV" EXCEPT SELECT document_id FROM Documents_with_expenses
|
### Context: CREATE TABLE Documents_with_expenses (document_id VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_type_code VARCHAR) ### Question: Show ids for all documents in type CV without expense budgets. ### Answer: SELECT document_id FROM Documents WHERE document_type_code = "CV" EXCEPT SELECT document_id FROM Documents_with_expenses
|
What are the ids of documents with letter 's' in the name with any expense budgets.
|
CREATE TABLE Documents_with_expenses (document_id VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR)
|
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%'
|
### Context: CREATE TABLE Documents_with_expenses (document_id VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_name VARCHAR) ### Question: What are the ids of documents with letter 's' in the name with any expense budgets. ### 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%'
|
How many documents do not have any expense?
|
CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR)
|
SELECT COUNT(*) FROM Documents WHERE NOT document_id IN (SELECT document_id FROM Documents_with_expenses)
|
### Context: CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id VARCHAR) ### Question: How many documents do not have any expense? ### Answer: SELECT COUNT(*) FROM Documents WHERE NOT document_id IN (SELECT document_id FROM Documents_with_expenses)
|
What are the dates for the documents with both 'GV' type and 'SF' type expenses?
|
CREATE TABLE Documents_with_Expenses (document_id VARCHAR, budget_type_code VARCHAR); CREATE TABLE Documents (document_date VARCHAR, document_id VARCHAR)
|
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'
|
### Context: CREATE TABLE Documents_with_Expenses (document_id VARCHAR, budget_type_code VARCHAR); CREATE TABLE Documents (document_date VARCHAR, document_id VARCHAR) ### Question: What are the dates for the documents with both 'GV' type and 'SF' type expenses? ### 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'
|
What are the account details with the largest value or with value having char '5' in it?
|
CREATE TABLE Accounts (Account_details INTEGER)
|
SELECT MAX(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%"
|
### Context: CREATE TABLE Accounts (Account_details INTEGER) ### Question: What are the account details with the largest value or with value having char '5' in it? ### Answer: SELECT MAX(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE "%5%"
|
Find the total number of scientists.
|
CREATE TABLE scientists (Id VARCHAR)
|
SELECT COUNT(*) FROM scientists
|
### Context: CREATE TABLE scientists (Id VARCHAR) ### Question: Find the total number of scientists. ### Answer: SELECT COUNT(*) FROM scientists
|
Find the total hours of all projects.
|
CREATE TABLE projects (hours INTEGER)
|
SELECT SUM(hours) FROM projects
|
### Context: CREATE TABLE projects (hours INTEGER) ### Question: Find the total hours of all projects. ### Answer: SELECT SUM(hours) FROM projects
|
How many different scientists are assigned to any project?
|
CREATE TABLE assignedto (scientist VARCHAR)
|
SELECT COUNT(DISTINCT scientist) FROM assignedto
|
### Context: CREATE TABLE assignedto (scientist VARCHAR) ### Question: How many different scientists are assigned to any project? ### Answer: SELECT COUNT(DISTINCT scientist) FROM assignedto
|
Find the number of distinct projects.
|
CREATE TABLE projects (name VARCHAR)
|
SELECT COUNT(DISTINCT name) FROM projects
|
### Context: CREATE TABLE projects (name VARCHAR) ### Question: Find the number of distinct projects. ### Answer: SELECT COUNT(DISTINCT name) FROM projects
|
Find the average hours of all projects.
|
CREATE TABLE projects (hours INTEGER)
|
SELECT AVG(hours) FROM projects
|
### Context: CREATE TABLE projects (hours INTEGER) ### Question: Find the average hours of all projects. ### Answer: SELECT AVG(hours) FROM projects
|
Find the name of project that continues for the longest time.
|
CREATE TABLE projects (name VARCHAR, hours VARCHAR)
|
SELECT name FROM projects ORDER BY hours DESC LIMIT 1
|
### Context: CREATE TABLE projects (name VARCHAR, hours VARCHAR) ### Question: Find the name of project that continues for the longest time. ### Answer: SELECT name FROM projects ORDER BY hours DESC LIMIT 1
|
List the name of all projects that are operated longer than the average working hours of all projects.
|
CREATE TABLE projects (name VARCHAR, hours INTEGER)
|
SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)
|
### Context: CREATE TABLE projects (name VARCHAR, hours INTEGER) ### Question: List the name of all projects that are operated longer than the average working hours of all projects. ### Answer: SELECT name FROM projects WHERE hours > (SELECT AVG(hours) FROM projects)
|
Find the name and hours of project that has the most number of scientists.
|
CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, hours VARCHAR, code VARCHAR)
|
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
|
### Context: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, hours VARCHAR, code VARCHAR) ### Question: Find the name and hours of project that has the most number of scientists. ### 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
|
Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to.
|
CREATE TABLE scientists (SSN VARCHAR, name VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR)
|
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%'
|
### Context: CREATE TABLE scientists (SSN VARCHAR, name VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR) ### Question: Find the name of the project for which a scientist whose name contains ‘Smith’ is assigned to. ### 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%'
|
Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to.
|
CREATE TABLE scientists (SSN VARCHAR, name VARCHAR); CREATE TABLE projects (hours INTEGER, code VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR)
|
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'
|
### Context: CREATE TABLE scientists (SSN VARCHAR, name VARCHAR); CREATE TABLE projects (hours INTEGER, code VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR) ### Question: Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to. ### 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'
|
Find the name of projects that require between 100 and 300 hours of work.
|
CREATE TABLE projects (name VARCHAR, hours INTEGER)
|
SELECT name FROM projects WHERE hours BETWEEN 100 AND 300
|
### Context: CREATE TABLE projects (name VARCHAR, hours INTEGER) ### Question: Find the name of projects that require between 100 and 300 hours of work. ### Answer: SELECT name FROM projects WHERE hours BETWEEN 100 AND 300
|
Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'.
|
CREATE TABLE projects (code VARCHAR, name VARCHAR); CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR)
|
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'
|
### Context: CREATE TABLE projects (code VARCHAR, name VARCHAR); CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR) ### Question: Find the name of the scientist who worked on both a project named 'Matter of Time' and a project named 'A Puzzling Parallax'. ### 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'
|
List the names of all scientists sorted in alphabetical order.
|
CREATE TABLE scientists (name VARCHAR)
|
SELECT name FROM scientists ORDER BY name
|
### Context: CREATE TABLE scientists (name VARCHAR) ### Question: List the names of all scientists sorted in alphabetical order. ### Answer: SELECT name FROM scientists ORDER BY name
|
Find the number of scientists involved for each project name.
|
CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR)
|
SELECT COUNT(*), T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name
|
### Context: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR) ### Question: Find the number of scientists involved for each project name. ### Answer: SELECT COUNT(*), T1.name FROM projects AS T1 JOIN assignedto AS T2 ON T1.code = T2.project GROUP BY T1.name
|
Find the number of scientists involved for the projects that require more than 300 hours.
|
CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR, hours INTEGER)
|
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
|
### Context: CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR, hours INTEGER) ### Question: Find the number of scientists involved for the projects that require more than 300 hours. ### 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
|
Find the number of projects which each scientist is working on and scientist's name.
|
CREATE TABLE scientists (name VARCHAR, ssn VARCHAR); CREATE TABLE assignedto (scientist VARCHAR)
|
SELECT COUNT(*), T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist GROUP BY T1.name
|
### Context: CREATE TABLE scientists (name VARCHAR, ssn VARCHAR); CREATE TABLE assignedto (scientist VARCHAR) ### Question: Find the number of projects which each scientist is working on and scientist's name. ### Answer: SELECT COUNT(*), T1.name FROM scientists AS T1 JOIN assignedto AS T2 ON T1.ssn = T2.scientist GROUP BY T1.name
|
Find the SSN and name of scientists who are assigned to the project with the longest hours.
|
CREATE TABLE scientists (ssn VARCHAR, name VARCHAR, SSN VARCHAR); CREATE TABLE projects (code VARCHAR, hours INTEGER); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (hours INTEGER)
|
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)
|
### Context: CREATE TABLE scientists (ssn VARCHAR, name VARCHAR, SSN VARCHAR); CREATE TABLE projects (code VARCHAR, hours INTEGER); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (hours INTEGER) ### Question: Find the SSN and name of scientists who are assigned to the project with the longest hours. ### 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)
|
Find the name of scientists who are assigned to some project.
|
CREATE TABLE assignedto (scientist VARCHAR); CREATE TABLE scientists (name VARCHAR, ssn VARCHAR)
|
SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist = T2.ssn
|
### Context: CREATE TABLE assignedto (scientist VARCHAR); CREATE TABLE scientists (name VARCHAR, ssn VARCHAR) ### Question: Find the name of scientists who are assigned to some project. ### Answer: SELECT T2.name FROM assignedto AS T1 JOIN scientists AS T2 ON T1.scientist = T2.ssn
|
Select the project names which are not assigned yet.
|
CREATE TABLE Projects (Name VARCHAR, Code VARCHAR, Project VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, Code VARCHAR, Project VARCHAR)
|
SELECT Name FROM Projects WHERE NOT Code IN (SELECT Project FROM AssignedTo)
|
### Context: CREATE TABLE Projects (Name VARCHAR, Code VARCHAR, Project VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, Code VARCHAR, Project VARCHAR) ### Question: Select the project names which are not assigned yet. ### Answer: SELECT Name FROM Projects WHERE NOT Code IN (SELECT Project FROM AssignedTo)
|
Find the name of scientists who are not assigned to any project.
|
CREATE TABLE scientists (Name VARCHAR, ssn VARCHAR, scientist VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, ssn VARCHAR, scientist VARCHAR)
|
SELECT Name FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)
|
### Context: CREATE TABLE scientists (Name VARCHAR, ssn VARCHAR, scientist VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, ssn VARCHAR, scientist VARCHAR) ### Question: Find the name of scientists who are not assigned to any project. ### Answer: SELECT Name FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)
|
Find the number of scientists who are not assigned to any project.
|
CREATE TABLE AssignedTo (ssn VARCHAR, scientist VARCHAR); CREATE TABLE scientists (ssn VARCHAR, scientist VARCHAR)
|
SELECT COUNT(*) FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)
|
### Context: CREATE TABLE AssignedTo (ssn VARCHAR, scientist VARCHAR); CREATE TABLE scientists (ssn VARCHAR, scientist VARCHAR) ### Question: Find the number of scientists who are not assigned to any project. ### Answer: SELECT COUNT(*) FROM scientists WHERE NOT ssn IN (SELECT scientist FROM AssignedTo)
|
Find the names of scientists who are not working on the project with the highest hours.
|
CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (code VARCHAR, hours INTEGER); CREATE TABLE scientists (name VARCHAR, hours INTEGER); CREATE TABLE projects (name VARCHAR, hours INTEGER)
|
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)
|
### Context: CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (code VARCHAR, hours INTEGER); CREATE TABLE scientists (name VARCHAR, hours INTEGER); CREATE TABLE projects (name VARCHAR, hours INTEGER) ### Question: Find the names of scientists who are not working on the project with the highest hours. ### 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)
|
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.
|
CREATE TABLE AssignedTo (Scientist VARCHAR, Project VARCHAR); CREATE TABLE Projects (Name VARCHAR, Hours VARCHAR, Code VARCHAR); CREATE TABLE Scientists (Name VARCHAR, SSN VARCHAR)
|
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, T1.Name
|
### Context: CREATE TABLE AssignedTo (Scientist VARCHAR, Project VARCHAR); CREATE TABLE Projects (Name VARCHAR, Hours VARCHAR, Code VARCHAR); CREATE TABLE Scientists (Name VARCHAR, SSN VARCHAR) ### 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. ### 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, T1.Name
|
Find name of the project that needs the least amount of time to finish and the name of scientists who worked on it.
|
CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR, hours INTEGER); CREATE TABLE projects (hours INTEGER)
|
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)
|
### Context: CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR, hours INTEGER); CREATE TABLE projects (hours INTEGER) ### Question: Find name of the project that needs the least amount of time to finish and the name of scientists who worked on it. ### 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)
|
What is the name of the highest rated wine?
|
CREATE TABLE WINE (Name VARCHAR, Score VARCHAR)
|
SELECT Name FROM WINE ORDER BY Score LIMIT 1
|
### Context: CREATE TABLE WINE (Name VARCHAR, Score VARCHAR) ### Question: What is the name of the highest rated wine? ### Answer: SELECT Name FROM WINE ORDER BY Score LIMIT 1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.