db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
cre_Doc_Control_Systems
select document_type_code from ref_document_types;
Question: what document type codes do we have? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipping_agent_co...
what document type codes do we have?
cre_Doc_Control_Systems
select document_type_description from ref_document_types where document_type_code = 'paper';
Question: what is the description of document type 'paper'? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> ship...
what is the description of document type 'paper'?
cre_Doc_Control_Systems
select shipping_agent_name from ref_shipping_agents;
Question: what are the shipping agent names? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipping_agent_code...
what are the shipping agent names?
cre_Doc_Control_Systems
select shipping_agent_code from ref_shipping_agents where shipping_agent_name = 'ups';
Question: what is the shipping agent code of shipping agent ups? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents ->...
what is the shipping agent code of shipping agent ups?
cre_Doc_Control_Systems
select role_code from roles;
Question: what are all role codes? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipping_agent_code, shipping...
what are all role codes?
cre_Doc_Control_Systems
select role_description from roles where role_code = 'ed';
Question: what is the description of role code ed? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipping_agen...
what is the description of role code ed?
cre_Doc_Control_Systems
select count(*) from employees;
Question: how many employees do we have? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipping_agent_code, sh...
how many employees do we have?
cre_Doc_Control_Systems
select t1.role_description from roles as t1 join employees as t2 on t1.role_code = t2.role_code where t2.employee_name = 'koby';
Question: what is the role of the employee named koby? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipping_...
what is the role of the employee named koby?
cre_Doc_Control_Systems
select document_id , receipt_date from documents;
Question: list all document ids and receipt dates of documents. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> ...
list all document ids and receipt dates of documents.
cre_Doc_Control_Systems
select t1.role_description , t2.role_code , count(*) from roles as t1 join employees as t2 on t1.role_code = t2.role_code group by t2.role_code;
Question: how many employees does each role have? list role description, id and number of employees. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status...
how many employees does each role have? list role description, id and number of employees.
cre_Doc_Control_Systems
select roles.role_description , count(employees.employee_id) from roles join employees on employees.role_code = roles.role_code group by employees.role_code having count(employees.employee_id) > 1;
Question: list roles that have more than one employee. list the role description and number of employees. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_s...
list roles that have more than one employee. list the role description and number of employees.
cre_Doc_Control_Systems
select ref_document_status.document_status_description from ref_document_status join documents on documents.document_status_code = ref_document_status.document_status_code where documents.document_id = 1;
Question: what is the document status description of the document with id 1? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shippi...
what is the document status description of the document with id 1?
cre_Doc_Control_Systems
select count(*) from documents where document_status_code = 'done';
Question: how many documents have the status code done? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipping...
how many documents have the status code done?
cre_Doc_Control_Systems
select document_type_code from documents where document_id = 2;
Question: list the document type code for the document with the id 2. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agen...
list the document type code for the document with the id 2.
cre_Doc_Control_Systems
select document_id from documents where document_status_code = 'done' and document_type_code = 'paper';
Question: list the document ids for any documents with the status code done and the type code paper. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status...
list the document ids for any documents with the status code done and the type code paper.
cre_Doc_Control_Systems
select ref_shipping_agents.shipping_agent_name from ref_shipping_agents join documents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code where documents.document_id = 2;
Question: what is the name of the shipping agent of the document with id 2? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shippin...
what is the name of the shipping agent of the document with id 2?
cre_Doc_Control_Systems
select count(*) from ref_shipping_agents join documents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code where ref_shipping_agents.shipping_agent_name = 'usps';
Question: how many documents were shipped by usps? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipping_agen...
how many documents were shipped by usps?
cre_Doc_Control_Systems
select ref_shipping_agents.shipping_agent_name , count(documents.document_id) from ref_shipping_agents join documents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code group by ref_shipping_agents.shipping_agent_code order by count(documents.document_id) desc limit 1;
Question: which shipping agent shipped the most documents? list the shipping agent name and the number of documents. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code,...
which shipping agent shipped the most documents? list the shipping agent name and the number of documents.
cre_Doc_Control_Systems
select receipt_date from documents where document_id = 3;
Question: what is the receipt date of the document with id 3? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> sh...
what is the receipt date of the document with id 3?
cre_Doc_Control_Systems
select addresses.address_details from addresses join documents_mailed on documents_mailed.mailed_to_address_id = addresses.address_id where document_id = 4;
Question: what address was the document with id 4 mailed to? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shi...
what address was the document with id 4 mailed to?
cre_Doc_Control_Systems
select mailing_date from documents_mailed where document_id = 7;
Question: what is the mail date of the document with id 7? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shipp...
what is the mail date of the document with id 7?
cre_Doc_Control_Systems
select document_id from documents where document_status_code = 'done' and document_type_code = 'paper' except select document_id from documents join ref_shipping_agents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code where ref_shipping_agents.shipping_agent_name = 'usps';
Question: list the document ids of documents with the status done and type paper, which not shipped by the shipping agent named usps. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> docu...
list the document ids of documents with the status done and type paper, which not shipped by the shipping agent named usps.
cre_Doc_Control_Systems
select document_id from documents where document_status_code = 'done' and document_type_code = 'paper' intersect select document_id from documents join ref_shipping_agents on documents.shipping_agent_code = ref_shipping_agents.shipping_agent_code where ref_shipping_agents.shipping_agent_name = 'usps';
Question: list document id of documents status is done and document type is paper and the document is shipped by shipping agent named usps. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -...
list document id of documents status is done and document type is paper and the document is shipped by shipping agent named usps.
cre_Doc_Control_Systems
select draft_details from document_drafts where document_id = 7;
Question: what is draft detail of the document with id 7? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -> shippi...
what is draft detail of the document with id 7?
cre_Doc_Control_Systems
select count(*) from draft_copies where document_id = 2;
Question: how many draft copies does the document with id 2 have? | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status_description. Ref_Shipping_Agents -...
how many draft copies does the document with id 2 have?
cre_Doc_Control_Systems
select document_id , count(copy_number) from draft_copies group by document_id order by count(copy_number) desc limit 1;
Question: which document has the most draft copies? list its document id and number of draft copies. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_status...
which document has the most draft copies? list its document id and number of draft copies.
cre_Doc_Control_Systems
select document_id , count(*) from draft_copies group by document_id having count(*) > 1;
Question: which documents have more than 1 draft copies? list document id and number of draft copies. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, document_statu...
which documents have more than 1 draft copies? list document id and number of draft copies.
cre_Doc_Control_Systems
select employees.employee_name from employees join circulation_history on circulation_history.employee_id = employees.employee_id where circulation_history.document_id = 1;
Question: list all employees in the circulation history of the document with id 1. list the employee's name. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_code, documen...
list all employees in the circulation history of the document with id 1. list the employee's name.
cre_Doc_Control_Systems
select employee_name from employees except select employees.employee_name from employees join circulation_history on circulation_history.employee_id = employees.employee_id
Question: list the employees who have not showed up in any circulation history of documents. list the employee's name. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -> document_status_cod...
list the employees who have not showed up in any circulation history of documents. list the employee's name.
cre_Doc_Control_Systems
select employees.employee_name , count(*) from employees join circulation_history on circulation_history.employee_id = employees.employee_id group by circulation_history.document_id , circulation_history.draft_number , circulation_history.copy_number order by count(*) desc limit 1;
Question: which employee has showed up in most circulation history documents. list the employee's name and the number of drafts and copies. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_details. Ref_Document_Status -...
which employee has showed up in most circulation history documents. list the employee's name and the number of drafts and copies.
cre_Doc_Control_Systems
select document_id , count(distinct employee_id) from circulation_history group by document_id;
Question: for each document, list the number of employees who have showed up in the circulation history of that document. list the document ids and number of employees. | Tables: Ref_Document_Types -> document_type_code, document_type_description. Roles -> role_code, role_description. Addresses -> address_id, address_d...
for each document, list the number of employees who have showed up in the circulation history of that document. list the document ids and number of employees.
company_1
select dname from department order by mgr_start_date
Question: list all department names ordered by their starting date. | Tables: works_on -> Essn, Pno, Hours. employee -> Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno. department -> Dname, Dnumber, Mgr_ssn, Mgr_start_date. project -> Pname, Pnumber, Plocation, Dnum. dependent -> Essn, Dependent_n...
list all department names ordered by their starting date.
company_1
select dependent_name from dependent where relationship = 'spouse'
Question: find all dependent names who have a spouse relation with some employee. | Tables: works_on -> Essn, Pno, Hours. employee -> Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno. department -> Dname, Dnumber, Mgr_ssn, Mgr_start_date. project -> Pname, Pnumber, Plocation, Dnum. dependent -> Ess...
find all dependent names who have a spouse relation with some employee.
company_1
select count(*) from dependent where sex = 'f'
Question: how many female dependents are there? | Tables: works_on -> Essn, Pno, Hours. employee -> Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno. department -> Dname, Dnumber, Mgr_ssn, Mgr_start_date. project -> Pname, Pnumber, Plocation, Dnum. dependent -> Essn, Dependent_name, Sex, Bdate, Rel...
how many female dependents are there?
company_1
select t1.dname from department as t1 join dept_locations as t2 on t1.dnumber = t2.dnumber where t2.dlocation = 'houston'
Question: find the names of departments that are located in houston. | Tables: works_on -> Essn, Pno, Hours. employee -> Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno. department -> Dname, Dnumber, Mgr_ssn, Mgr_start_date. project -> Pname, Pnumber, Plocation, Dnum. dependent -> Essn, Dependent_...
find the names of departments that are located in houston.
company_1
select fname , lname from employee where salary > 30000
Question: return the first names and last names of employees who earn more than 30000 in salary. | Tables: works_on -> Essn, Pno, Hours. employee -> Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno. department -> Dname, Dnumber, Mgr_ssn, Mgr_start_date. project -> Pname, Pnumber, Plocation, Dnum. d...
return the first names and last names of employees who earn more than 30000 in salary.
company_1
select count(*) , sex from employee where salary < 50000 group by sex
Question: find the number of employees of each gender whose salary is lower than 50000. | Tables: works_on -> Essn, Pno, Hours. employee -> Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno. department -> Dname, Dnumber, Mgr_ssn, Mgr_start_date. project -> Pname, Pnumber, Plocation, Dnum. dependent ...
find the number of employees of each gender whose salary is lower than 50000.
company_1
select fname , lname , address from employee order by bdate
Question: list the first and last names, and the addresses of all employees in the ascending order of their birth date. | Tables: works_on -> Essn, Pno, Hours. employee -> Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno. department -> Dname, Dnumber, Mgr_ssn, Mgr_start_date. project -> Pname, Pnum...
list the first and last names, and the addresses of all employees in the ascending order of their birth date.
local_govt_in_alabama
select t1.event_details from events as t1 join services as t2 on t1.service_id = t2.service_id where t2.service_type_code = 'marriage'
Question: what are the event details of the services that have the type code 'marriage'? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | J...
what are the event details of the services that have the type code 'marriage'?
local_govt_in_alabama
select t1.event_id , t1.event_details from events as t1 join participants_in_events as t2 on t1.event_id = t2.event_id group by t1.event_id having count(*) > 1
Question: what are the ids and details of events that have more than one participants? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joi...
what are the ids and details of events that have more than one participants?
local_govt_in_alabama
select t1.participant_id , t1.participant_type_code , count(*) from participants as t1 join participants_in_events as t2 on t1.participant_id = t2.participant_id group by t1.participant_id
Question: how many events have each participants attended? list the participant id, type and the number. | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Par...
how many events have each participants attended? list the participant id, type and the number.
local_govt_in_alabama
select participant_id , participant_type_code , participant_details from participants
Question: what are all the the participant ids, type code and details? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events.Servi...
what are all the the participant ids, type code and details?
local_govt_in_alabama
select count(*) from participants where participant_type_code = 'organizer'
Question: how many participants belong to the type 'organizer'? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events.Service_ID =...
how many participants belong to the type 'organizer'?
local_govt_in_alabama
select service_type_code from services order by service_type_code
Question: list the type of the services in alphabetical order. | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events.Service_ID = ...
list the type of the services in alphabetical order.
local_govt_in_alabama
select service_id , event_details from events
Question: list the service id and details for the events. | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events.Service_ID = Servi...
list the service id and details for the events.
local_govt_in_alabama
select count(*) from participants as t1 join participants_in_events as t2 on t1.participant_id = t2.participant_id where t1.participant_details like '%dr.%'
Question: how many events had participants whose details had the substring 'dr.' | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Ev...
how many events had participants whose details had the substring 'dr.'
local_govt_in_alabama
select participant_type_code from participants group by participant_type_code order by count(*) desc limit 1
Question: what is the most common participant type? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events.Service_ID = Services.Se...
what is the most common participant type?
local_govt_in_alabama
select t3.service_id , t4.service_type_code from participants as t1 join participants_in_events as t2 on t1.participant_id = t2.participant_id join events as t3 on t2.event_id = t3.event_id join services as t4 on t3.service_id = t4.service_id group by t3.service_id order by count(*) asc limit 1
Question: which service id and type has the least number of participants? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events.Se...
which service id and type has the least number of participants?
local_govt_in_alabama
select event_id from participants_in_events group by event_id order by count(*) desc limit 1
Question: what is the id of the event with the most participants? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events.Service_ID...
what is the id of the event with the most participants?
local_govt_in_alabama
select event_id from events except select t1.event_id from participants_in_events as t1 join participants as t2 on t1.participant_id = t2.participant_id where participant_details = 'kenyatta kuhn'
Question: which events id does not have any participant with detail 'kenyatta kuhn'? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins...
which events id does not have any participant with detail 'kenyatta kuhn'?
local_govt_in_alabama
select t1.service_type_code from services as t1 join events as t2 on t1.service_id = t2.service_id where t2.event_details = 'success' intersect select t1.service_type_code from services as t1 join events as t2 on t1.service_id = t2.service_id where t2.event_details = 'fail'
Question: which services type had both successful and failure event details? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events...
which services type had both successful and failure event details?
local_govt_in_alabama
select count(*) from events where event_id not in (select event_id from participants_in_events)
Question: how many events did not have any participants? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events.Service_ID = Servic...
how many events did not have any participants?
local_govt_in_alabama
select count(distinct participant_id) from participants_in_events
Question: what are all the distinct participant ids who attended any events? | Tables: Services -> Service_ID, Service_Type_Code. Participants -> Participant_ID, Participant_Type_Code, Participant_Details. Events -> Event_ID, Service_ID, Event_Details. Participants_in_Events -> Event_ID, Participant_ID. | Joins: Events...
what are all the distinct participant ids who attended any events?
formula_1
select name from races order by date desc limit 1
Question: what is the name of the race held most recently? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> statusId,...
what is the name of the race held most recently?
formula_1
select name from races order by date desc limit 1
Question: what is the name of the race that occurred most recently? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> ...
what is the name of the race that occurred most recently?
formula_1
select name , date from races order by date desc limit 1
Question: what is the name and date of the most recent race? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> statusI...
what is the name and date of the most recent race?
formula_1
select name , date from races order by date desc limit 1
Question: what is the name and date of the race that occurred most recently? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. s...
what is the name and date of the race that occurred most recently?
formula_1
select name from races where year = 2017
Question: find the names of all races held in 2017. | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> statusId, status...
find the names of all races held in 2017.
formula_1
select name from races where year = 2017
Question: what are the names of all the races that occurred in the year 2017? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. ...
what are the names of all the races that occurred in the year 2017?
formula_1
select distinct name from races where year between 2014 and 2017
Question: find the distinct names of all races held between 2014 and 2017? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. sta...
find the distinct names of all races held between 2014 and 2017?
formula_1
select distinct name from races where year between 2014 and 2017
Question: what are the unique names of all race held between 2014 and 2017? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. st...
what are the unique names of all race held between 2014 and 2017?
formula_1
select distinct t1.forename , t1.surname from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid where t2.milliseconds < 93000
Question: list the forename and surname of all distinct drivers who once had laptime less than 93000 milliseconds? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, foren...
list the forename and surname of all distinct drivers who once had laptime less than 93000 milliseconds?
formula_1
select distinct t1.forename , t1.surname from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid where t2.milliseconds < 93000
Question: what are the forenames and surnames of all unique drivers who had a lap time of less than 93000 milliseconds? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, ...
what are the forenames and surnames of all unique drivers who had a lap time of less than 93000 milliseconds?
formula_1
select distinct t1.driverid , t1.nationality from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid where t2.milliseconds > 100000
Question: find all the distinct id and nationality of drivers who have had laptime more than 100000 milliseconds? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forena...
find all the distinct id and nationality of drivers who have had laptime more than 100000 milliseconds?
formula_1
select distinct t1.driverid , t1.nationality from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid where t2.milliseconds > 100000
Question: what are the different driver ids and nationalities of all drivers who had a laptime of more than 100000 milliseconds? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, numbe...
what are the different driver ids and nationalities of all drivers who had a laptime of more than 100000 milliseconds?
formula_1
select t1.forename , t1.surname from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid order by t2.milliseconds limit 1
Question: what are the forename and surname of the driver who has the smallest laptime? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, national...
what are the forename and surname of the driver who has the smallest laptime?
formula_1
select t1.forename , t1.surname from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid order by t2.milliseconds limit 1
Question: what is the forename and surname of the driver with the shortest laptime? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality,...
what is the forename and surname of the driver with the shortest laptime?
formula_1
select t1.driverid , t1.surname from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid order by t2.milliseconds desc limit 1
Question: what is the id and family name of the driver who has the longest laptime? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality,...
what is the id and family name of the driver who has the longest laptime?
formula_1
select t1.driverid , t1.surname from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid order by t2.milliseconds desc limit 1
Question: what is the id and last name of the driver with the longest laptime? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url....
what is the id and last name of the driver with the longest laptime?
formula_1
select t1.driverid , t1.forename , t1.surname from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid where position = '1' group by t1.driverid having count(*) >= 2
Question: what is the id, forname and surname of the driver who had the first position in terms of laptime at least twice? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, cod...
what is the id, forname and surname of the driver who had the first position in terms of laptime at least twice?
formula_1
select t1.driverid , t1.forename , t1.surname from drivers as t1 join laptimes as t2 on t1.driverid = t2.driverid where position = '1' group by t1.driverid having count(*) >= 2
Question: what is the id, first name, and last name of the driver who was in the first position for laptime at least twice? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, co...
what is the id, first name, and last name of the driver who was in the first position for laptime at least twice?
formula_1
select count(*) from results as t1 join races as t2 on t1.raceid = t2.raceid where t2.name = 'australian grand prix' and year = 2009
Question: how many drivers participated in the race australian grand prix held in 2009? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, national...
how many drivers participated in the race australian grand prix held in 2009?
formula_1
select count(*) from results as t1 join races as t2 on t1.raceid = t2.raceid where t2.name = 'australian grand prix' and year = 2009
Question: how many drivers were in the australian grand prix held in 2009? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. sta...
how many drivers were in the australian grand prix held in 2009?
formula_1
select count(distinct driverid) from results where raceid not in( select raceid from races where year != 2009 )
Question: how many drivers did not participate in the races held in 2009? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. stat...
how many drivers did not participate in the races held in 2009?
formula_1
select count(distinct driverid) from results where raceid not in( select raceid from races where year != 2009 )
Question: how many drivers did not race in 2009? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> statusId, status. s...
how many drivers did not race in 2009?
formula_1
select t2.name , t2.year from results as t1 join races as t2 on t1.raceid = t2.raceid join drivers as t3 on t1.driverid = t3.driverid where t3.forename = 'lewis'
Question: give me a list of names and years of races that had any driver whose forename is lewis? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob...
give me a list of names and years of races that had any driver whose forename is lewis?
formula_1
select t2.name , t2.year from results as t1 join races as t2 on t1.raceid = t2.raceid join drivers as t3 on t1.driverid = t3.driverid where t3.forename = 'lewis'
Question: what are the names and years of all races that had a driver with the last name lewis? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, ...
what are the names and years of all races that had a driver with the last name lewis?
formula_1
select forename , surname from drivers where nationality = 'german'
Question: find the forename and surname of drivers whose nationality is german? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url...
find the forename and surname of drivers whose nationality is german?
formula_1
select forename , surname from drivers where nationality = 'german'
Question: what is the first and last name of all the german drivers? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status ->...
what is the first and last name of all the german drivers?
formula_1
select t2.driverid , t3.forename from races as t1 join results as t2 on t1.raceid = t2.raceid join drivers as t3 on t2.driverid = t3.driverid where t1.name = 'australian grand prix' intersect select t2.driverid , t3.forename from races as t1 join results as t2 on t1.raceid = t2.raceid join drivers as t3 on t2.drive...
Question: find the id and forenames of drivers who participated both the races with name australian grand prix and the races with name chinese grand prix? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> ...
find the id and forenames of drivers who participated both the races with name australian grand prix and the races with name chinese grand prix?
formula_1
select t2.driverid , t3.forename from races as t1 join results as t2 on t1.raceid = t2.raceid join drivers as t3 on t2.driverid = t3.driverid where t1.name = 'australian grand prix' intersect select t2.driverid , t3.forename from races as t1 join results as t2 on t1.raceid = t2.raceid join drivers as t3 on t2.drive...
Question: what is the id and first name of all the drivers who participated in the australian grand prix and the chinese grand prix? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, n...
what is the id and first name of all the drivers who participated in the australian grand prix and the chinese grand prix?
formula_1
select t3.forename , t3.surname from races as t1 join results as t2 on t1.raceid = t2.raceid join drivers as t3 on t2.driverid = t3.driverid where t1.name = 'australian grand prix' except select t3.forename , t3.surname from races as t1 join results as t2 on t1.raceid = t2.raceid join drivers as t3 on t2.driverid = t...
Question: what are the forenames and surnames of drivers who participated in the races named australian grand prix but not the races named chinese grand prix? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers...
what are the forenames and surnames of drivers who participated in the races named australian grand prix but not the races named chinese grand prix?
formula_1
select t3.forename , t3.surname from races as t1 join results as t2 on t1.raceid = t2.raceid join drivers as t3 on t2.driverid = t3.driverid where t1.name = 'australian grand prix' except select t3.forename , t3.surname from races as t1 join results as t2 on t1.raceid = t2.raceid join drivers as t3 on t2.driverid = t...
Question: what are the first and last names of all drivers who participated in the australian grand prix but not the chinese grand prix? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRe...
what are the first and last names of all drivers who participated in the australian grand prix but not the chinese grand prix?
formula_1
select distinct t1.forename from drivers as t1 join driverstandings as t2 on t1.driverid = t2.driverid where t2.position = 1 and t2.wins = 1
Question: find all the forenames of distinct drivers who was in position 1 as standing and won? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, ...
find all the forenames of distinct drivers who was in position 1 as standing and won?
formula_1
select distinct t1.forename from drivers as t1 join driverstandings as t2 on t1.driverid = t2.driverid where t2.position = 1 and t2.wins = 1
Question: what are all the different first names of the drivers who are in position as standing and won? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surna...
what are all the different first names of the drivers who are in position as standing and won?
formula_1
select distinct t1.forename from drivers as t1 join driverstandings as t2 on t1.driverid = t2.driverid where t2.position = 1 and t2.wins = 1 and t2.points > 20
Question: find all the forenames of distinct drivers who won in position 1 as driver standing and had more than 20 points? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, cod...
find all the forenames of distinct drivers who won in position 1 as driver standing and had more than 20 points?
formula_1
select distinct t1.forename from drivers as t1 join driverstandings as t2 on t1.driverid = t2.driverid where t2.position = 1 and t2.wins = 1 and t2.points > 20
Question: what are the first names of the different drivers who won in position 1 as driver standing and had more than 20 points? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, numb...
what are the first names of the different drivers who won in position 1 as driver standing and had more than 20 points?
formula_1
select count(*) , nationality from constructors group by nationality
Question: what are the numbers of constructors for different nationalities? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. st...
what are the numbers of constructors for different nationalities?
formula_1
select count(*) , nationality from constructors group by nationality
Question: for each nationality, how many different constructors are there? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. sta...
for each nationality, how many different constructors are there?
formula_1
select count(*) , constructorid from constructorstandings group by constructorid
Question: what are the numbers of races for each constructor id? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> sta...
what are the numbers of races for each constructor id?
formula_1
select count(*) , constructorid from constructorstandings group by constructorid
Question: for each constructor id, how many races are there? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> statusI...
for each constructor id, how many races are there?
formula_1
select t1.name from races as t1 join circuits as t2 on t1.circuitid = t2.circuitid where t2.country = 'spain' and t1.year > 2017
Question: what are the names of races that were held after 2017 and the circuits were in the country of spain? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename,...
what are the names of races that were held after 2017 and the circuits were in the country of spain?
formula_1
select t1.name from races as t1 join circuits as t2 on t1.circuitid = t2.circuitid where t2.country = 'spain' and t1.year > 2017
Question: what are the names of the races held after 2017 in spain? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> ...
what are the names of the races held after 2017 in spain?
formula_1
select distinct t1.name from races as t1 join circuits as t2 on t1.circuitid = t2.circuitid where t2.country = 'spain' and t1.year > 2000
Question: what are the unique names of races that held after 2000 and the circuits were in spain? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob...
what are the unique names of races that held after 2000 and the circuits were in spain?
formula_1
select distinct t1.name from races as t1 join circuits as t2 on t1.circuitid = t2.circuitid where t2.country = 'spain' and t1.year > 2000
Question: what are the names of all races held after 2000 in spain? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. status -> ...
what are the names of all races held after 2000 in spain?
formula_1
select distinct driverid , stop from pitstops where duration < (select max(duration) from pitstops where raceid = 841)
Question: find the distinct driver id and the stop number of all drivers that have a shorter pit stop duration than some drivers in the race with id 841. | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> d...
find the distinct driver id and the stop number of all drivers that have a shorter pit stop duration than some drivers in the race with id 841.
formula_1
select distinct driverid , stop from pitstops where duration < (select max(duration) from pitstops where raceid = 841)
Question: what is the id and stop number for each driver that has a shorter pit stop than the driver in the race with id 841? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, ...
what is the id and stop number for each driver that has a shorter pit stop than the driver in the race with id 841?
formula_1
select distinct driverid , stop from pitstops where duration > (select min(duration) from pitstops where raceid = 841)
Question: find the distinct driver id of all drivers that have a longer stop duration than some drivers in the race whose id is 841? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, n...
find the distinct driver id of all drivers that have a longer stop duration than some drivers in the race whose id is 841?
formula_1
select distinct driverid , stop from pitstops where duration > (select min(duration) from pitstops where raceid = 841)
Question: what are the different ids and stop durations of all the drivers whose stop lasted longer than the driver in the race with the id 841? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, ...
what are the different ids and stop durations of all the drivers whose stop lasted longer than the driver in the race with the id 841?
formula_1
select distinct forename from drivers order by forename asc
Question: list the forenames of all distinct drivers in alphabetical order? | Tables: circuits -> circuitId, circuitRef, name, location, country, lat, lng, alt, url. races -> raceId, year, round, circuitId, name, date, time, url. drivers -> driverId, driverRef, number, code, forename, surname, dob, nationality, url. st...
list the forenames of all distinct drivers in alphabetical order?