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