combined_text
stringlengths 106
1.05k
|
---|
###question:Show the name of drivers in descending order of age.###answer:SELECT name FROM driver ORDER BY age DESC###context:CREATE TABLE driver (name VARCHAR, age VARCHAR)
|
###question:Show all different home cities.###answer:SELECT DISTINCT home_city FROM driver###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###context:CREATE TABLE driver (home_city 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###context:CREATE TABLE driver (party VARCHAR, home_city VARCHAR, age VARCHAR)
|
###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###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###context:CREATE TABLE driver (home_city VARCHAR, age INTEGER)
|
###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)###context:CREATE TABLE school_bus (name VARCHAR, driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)
|
###question:Show the types of schools that have two schools.###answer:SELECT TYPE FROM school GROUP BY TYPE HAVING COUNT(*) = 2###context:CREATE TABLE school (TYPE 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###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: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###context:CREATE TABLE school_bus (years_working INTEGER)
|
###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)###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 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###context:CREATE TABLE school (type VARCHAR, school_id VARCHAR); CREATE TABLE school_bus (school_id 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###context:CREATE TABLE driver (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###context:CREATE TABLE driver (name VARCHAR, home_city VARCHAR, age 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###context:CREATE TABLE school_bus (driver_id VARCHAR); CREATE TABLE driver (name VARCHAR, driver_id VARCHAR)
|
###question:How many flights have a velocity larger than 200?###answer:SELECT COUNT(*) FROM flight WHERE velocity > 200###context:CREATE TABLE flight (velocity INTEGER)
|
###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###context:CREATE TABLE flight (vehicle_flight_number VARCHAR, date VARCHAR, pilot VARCHAR, altitude 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###context:CREATE TABLE airport (id VARCHAR, country VARCHAR, city VARCHAR, name VARCHAR)
|
###question:What is maximum group equity shareholding of the companies?###answer:SELECT MAX(group_equity_shareholding) FROM operate_company###context:CREATE TABLE operate_company (group_equity_shareholding INTEGER)
|
###question:What is the velocity of the pilot named 'Thompson'?###answer:SELECT AVG(velocity) FROM flight WHERE pilot = 'Thompson'###context:CREATE TABLE flight (velocity INTEGER, pilot 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###context:CREATE TABLE operate_company (name VARCHAR, type VARCHAR, id VARCHAR); CREATE TABLE flight (Id VARCHAR)
|
###question:What are the names of the airports which are not in the country 'Iceland'?###answer:SELECT name FROM airport WHERE country <> 'Iceland'###context:CREATE TABLE airport (name VARCHAR, country 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###context:CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (type VARCHAR, id 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###context:CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR, name 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###context:CREATE TABLE airport (id VARCHAR, name VARCHAR, IATA VARCHAR); CREATE TABLE flight (id 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'###context:CREATE TABLE airport (id VARCHAR, country VARCHAR, name VARCHAR); CREATE TABLE flight (pilot VARCHAR, airport_id 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###context:CREATE TABLE operate_company (TYPE 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')###context:CREATE TABLE airport (id VARCHAR, airport_id VARCHAR, pilot VARCHAR); CREATE TABLE flight (id VARCHAR, airport_id VARCHAR, pilot 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'###context:CREATE TABLE operate_company (id VARCHAR, principal_activities VARCHAR); CREATE TABLE flight (Id VARCHAR)
|
###question:Which of the airport names contains the word 'international'?###answer:SELECT name FROM airport WHERE name LIKE '%international%'###context:CREATE TABLE airport (name 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###context:CREATE TABLE airport (id VARCHAR); CREATE TABLE flight (Id VARCHAR); CREATE TABLE operate_company (id VARCHAR)
|
###question:how many airports are there in each country?###answer:SELECT COUNT(*), country FROM airport GROUP BY country###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###context:CREATE TABLE airport (country 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###context:CREATE TABLE flight (pilot VARCHAR)
|
###question:Show all account ids and account details.###answer:SELECT account_id, account_details FROM Accounts###context:CREATE TABLE Accounts (account_id VARCHAR, account_details VARCHAR)
|
###question:How many statements do we have?###answer:SELECT COUNT(*) FROM Statements###context:CREATE TABLE Statements (Id VARCHAR)
|
###question:List all statement ids and statement details.###answer:SELECT STATEMENT_ID, statement_details FROM Statements###context:CREATE TABLE Statements (STATEMENT_ID VARCHAR, statement_details 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###context:CREATE TABLE Accounts (statement_id VARCHAR, account_details VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, 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###context:CREATE TABLE Accounts (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###context:CREATE TABLE Accounts (statement_id VARCHAR); CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR)
|
###question:Show the number of documents.###answer:SELECT COUNT(*) FROM Documents###context:CREATE TABLE Documents (Id 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'###context:CREATE TABLE Documents (document_type_code VARCHAR, document_name VARCHAR, document_description VARCHAR)
|
###question:Show the ids and names of all documents.###answer:SELECT document_id, document_name FROM Documents###context:CREATE TABLE Documents (document_id VARCHAR, document_name 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"###context:CREATE TABLE Documents (document_name VARCHAR, document_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###context:CREATE TABLE Documents (project_id VARCHAR, document_type_code 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'###context:CREATE TABLE Documents (project_id VARCHAR); CREATE TABLE projects (project_id VARCHAR, project_details VARCHAR)
|
###question:Show project ids and the number of documents in each project.###answer:SELECT project_id, COUNT(*) FROM Documents GROUP BY project_id###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###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###context:CREATE TABLE Documents (project_id 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###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###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###context:CREATE TABLE Documents (document_type_code 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'###context:CREATE TABLE Statements (statement_details VARCHAR, statement_id VARCHAR); CREATE TABLE Documents (document_name VARCHAR, document_id 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###context:CREATE TABLE Ref_document_types (document_type_code VARCHAR, document_type_name VARCHAR, document_type_description 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"###context:CREATE TABLE Ref_document_types (document_type_description VARCHAR, document_type_name 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###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:Show the number of projects.###answer:SELECT COUNT(*) FROM Projects###context:CREATE TABLE Projects (Id VARCHAR)
|
###question:List ids and details for all projects.###answer:SELECT project_id, project_details FROM Projects###context:CREATE TABLE Projects (project_id VARCHAR, project_details 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###context:CREATE TABLE Projects (project_id VARCHAR, project_details VARCHAR); CREATE TABLE Documents (project_id 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"###context:CREATE TABLE Projects (project_details VARCHAR, project_id VARCHAR); CREATE TABLE Documents (project_id VARCHAR, document_name VARCHAR)
|
###question:How many budget types do we have?###answer:SELECT COUNT(*) FROM Ref_budget_codes###context:CREATE TABLE Ref_budget_codes (Id VARCHAR)
|
###question:List all budget type codes and descriptions.###answer: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: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"###context:CREATE TABLE Ref_budget_codes (budget_type_description VARCHAR, budget_type_code VARCHAR)
|
###question:How many documents have expenses?###answer:SELECT COUNT(*) FROM Documents_with_expenses###context:CREATE TABLE Documents_with_expenses (Id 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'###context: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###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 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"###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 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###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###context:CREATE TABLE Documents_with_expenses (budget_type_code 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###context:CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (document_id 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###context:CREATE TABLE Documents_with_expenses (document_id VARCHAR, document_type_code VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_type_code 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%'###context:CREATE TABLE Documents_with_expenses (document_id VARCHAR); CREATE TABLE Documents (document_id VARCHAR, document_name 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)###context:CREATE TABLE Documents (document_id VARCHAR); CREATE TABLE Documents_with_expenses (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'###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 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%"###context:CREATE TABLE Accounts (Account_details INTEGER)
|
###question:Find the total number of scientists.###answer:SELECT COUNT(*) FROM scientists###context:CREATE TABLE scientists (Id VARCHAR)
|
###question:Find the total hours of all projects.###answer:SELECT SUM(hours) FROM projects###context:CREATE TABLE projects (hours INTEGER)
|
###question:How many different scientists are assigned to any project?###answer:SELECT COUNT(DISTINCT scientist) FROM assignedto###context:CREATE TABLE assignedto (scientist VARCHAR)
|
###question:Find the number of distinct projects.###answer:SELECT COUNT(DISTINCT name) FROM projects###context:CREATE TABLE projects (name VARCHAR)
|
###question:Find the average hours of all projects.###answer:SELECT AVG(hours) FROM projects###context:CREATE TABLE projects (hours INTEGER)
|
###question:Find the name of project that continues for the longest time.###answer:SELECT name FROM projects ORDER BY hours DESC LIMIT 1###context:CREATE TABLE projects (name VARCHAR, hours VARCHAR)
|
###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)###context:CREATE TABLE projects (name VARCHAR, hours INTEGER)
|
###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###context:CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, hours 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%'###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 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'###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 name of projects that require between 100 and 300 hours of work.###answer:SELECT name FROM projects WHERE hours BETWEEN 100 AND 300###context:CREATE TABLE projects (name VARCHAR, hours INTEGER)
|
###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'###context:CREATE TABLE projects (code VARCHAR, name VARCHAR); CREATE TABLE scientists (name VARCHAR, SSN VARCHAR); CREATE TABLE assignedto (project VARCHAR, scientist VARCHAR)
|
###question:List the names of all scientists sorted in alphabetical order.###answer:SELECT name FROM scientists ORDER BY name###context:CREATE TABLE scientists (name 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###context:CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR)
|
###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###context:CREATE TABLE assignedto (project VARCHAR); CREATE TABLE projects (name VARCHAR, code VARCHAR, hours INTEGER)
|
###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###context:CREATE TABLE scientists (name VARCHAR, ssn VARCHAR); CREATE TABLE assignedto (scientist VARCHAR)
|
###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)###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 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###context:CREATE TABLE assignedto (scientist VARCHAR); CREATE TABLE scientists (name VARCHAR, ssn VARCHAR)
|
###question:Select the project names which are not assigned yet.###answer: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: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)###context:CREATE TABLE scientists (Name VARCHAR, ssn VARCHAR, scientist VARCHAR); CREATE TABLE AssignedTo (Name VARCHAR, 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)###context:CREATE TABLE AssignedTo (ssn VARCHAR, scientist VARCHAR); CREATE TABLE scientists (ssn VARCHAR, scientist VARCHAR)
|
###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)###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: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###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: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)###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:What is the name of the highest rated wine?###answer:SELECT Name FROM WINE ORDER BY Score LIMIT 1###context:CREATE TABLE WINE (Name VARCHAR, Score VARCHAR)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.