id
int64
0
8.66k
db_id
stringclasses
146 values
schema
stringclasses
146 values
question
stringlengths
3
224
output
stringlengths
18
577
2,100
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What document type codes do we have?
SELECT document_type_code FROM Ref_Document_Types;
2,101
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is the description of document type 'Paper'?
SELECT document_type_description FROM Ref_Document_Types WHERE document_type_code = "Paper";
2,102
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What are the shipping agent names?
SELECT shipping_agent_name FROM Ref_Shipping_Agents;
2,103
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is the shipping agent code of shipping agent UPS?
SELECT shipping_agent_code FROM Ref_Shipping_Agents WHERE shipping_agent_name = "UPS";
2,104
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What are all role codes?
SELECT role_code FROM ROLES;
2,105
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is the description of role code ED?
SELECT role_description FROM ROLES WHERE role_code = "ED";
2,106
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
How many employees do we have?
SELECT count(*) FROM Employees;
2,107
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is the role of the employee named Koby?
SELECT T1.role_description FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code WHERE T2.employee_name = "Koby";
2,108
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
List all document ids and receipt dates of documents.
SELECT document_id , receipt_date FROM Documents;
2,109
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
How many employees does each role have? List role description, id and number of employees.
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;
2,110
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
List roles that have more than one employee. List the role description and number of employees.
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;
2,111
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is the document status description of the document with id 1?
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;
2,112
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
How many documents have the status code done?
SELECT count(*) FROM Documents WHERE document_status_code = "done";
2,113
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
List the document type code for the document with the id 2.
SELECT document_type_code FROM Documents WHERE document_id = 2;
2,114
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
List the document ids for any documents with the status code done and the type code paper.
SELECT document_id FROM Documents WHERE document_status_code = "done" AND document_type_code = "Paper";
2,115
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is the name of the shipping agent of the document with id 2?
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;
2,116
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
How many documents were shipped by USPS?
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";
2,117
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
Which shipping agent shipped the most documents? List the shipping agent name and the number of documents.
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;
2,118
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is the receipt date of the document with id 3?
SELECT receipt_date FROM Documents WHERE document_id = 3;
2,119
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What address was the document with id 4 mailed to?
SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4;
2,120
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is the mail date of the document with id 7?
SELECT mailing_date FROM Documents_Mailed WHERE document_id = 7;
2,121
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
List the document ids of documents with the status done and type Paper, which not shipped by the shipping agent named USPS.
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";
2,122
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
List document id of documents status is done and document type is Paper and the document is shipped by shipping agent named USPS.
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";
2,123
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
What is draft detail of the document with id 7?
SELECT draft_details FROM Document_Drafts WHERE document_id = 7;
2,124
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
How many draft copies does the document with id 2 have?
SELECT count(*) FROM Draft_Copies WHERE document_id = 2;
2,125
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
Which document has the most draft copies? List its document id and number of draft copies.
SELECT document_id , count(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY count(copy_number) DESC LIMIT 1;
2,126
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
Which documents have more than 1 draft copies? List document id and number of draft copies.
SELECT document_id , count(*) FROM Draft_Copies GROUP BY document_id HAVING count(*) > 1;
2,127
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
List all employees in the circulation history of the document with id 1. List the employee's name.
SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id WHERE Circulation_History.document_id = 1;
2,128
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
List the employees who have not showed up in any circulation history of documents. List the employee's name.
SELECT employee_name FROM Employees EXCEPT SELECT Employees.employee_name FROM Employees JOIN Circulation_History ON Circulation_History.employee_id = Employees.employee_id
2,129
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
Which employee has showed up in most circulation history documents. List the employee's name and the number of drafts and copies.
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;
2,130
cre_Doc_Control_Systems
CREATE TABLE Ref_Document_Types ( document_type_code CHAR( 15 ) NOT NULL, document_type_description VARCHAR( 255 ) NOT NULL, PRIMARY KEY ( document_type_code ) ); CREATE TABLE Roles ( role_code CHAR( 15 ) NOT NULL, role_description VARCHAR( 255 ), PRIMARY KEY ( role_code ) ); CREAT...
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.
SELECT document_id , count(DISTINCT employee_id) FROM Circulation_History GROUP BY document_id;
2,131
company_1
CREATE TABLE works_on( Essn INTEGER, Pno INTEGER, Hours REAL, PRIMARY KEY( Essn, Pno ) ); CREATE TABLE employee( Fname TEXT, Minit TEXT, Lname TEXT, Ssn INTEGER PRIMARY KEY, Bdate TEXT, Address TEXT, Sex TEXT, Salary INTEGER, Super_ssn INTEGER, Dno INTEGER ); CREATE TABLE department( Dname...
List all department names ordered by their starting date.
SELECT dname FROM department ORDER BY mgr_start_date
2,132
company_1
CREATE TABLE works_on( Essn INTEGER, Pno INTEGER, Hours REAL, PRIMARY KEY( Essn, Pno ) ); CREATE TABLE employee( Fname TEXT, Minit TEXT, Lname TEXT, Ssn INTEGER PRIMARY KEY, Bdate TEXT, Address TEXT, Sex TEXT, Salary INTEGER, Super_ssn INTEGER, Dno INTEGER ); CREATE TABLE department( Dname...
find all dependent names who have a spouse relation with some employee.
SELECT Dependent_name FROM dependent WHERE relationship = 'Spouse'
2,133
company_1
CREATE TABLE works_on( Essn INTEGER, Pno INTEGER, Hours REAL, PRIMARY KEY( Essn, Pno ) ); CREATE TABLE employee( Fname TEXT, Minit TEXT, Lname TEXT, Ssn INTEGER PRIMARY KEY, Bdate TEXT, Address TEXT, Sex TEXT, Salary INTEGER, Super_ssn INTEGER, Dno INTEGER ); CREATE TABLE department( Dname...
how many female dependents are there?
SELECT count(*) FROM dependent WHERE sex = 'F'
2,134
company_1
CREATE TABLE works_on( Essn INTEGER, Pno INTEGER, Hours REAL, PRIMARY KEY( Essn, Pno ) ); CREATE TABLE employee( Fname TEXT, Minit TEXT, Lname TEXT, Ssn INTEGER PRIMARY KEY, Bdate TEXT, Address TEXT, Sex TEXT, Salary INTEGER, Super_ssn INTEGER, Dno INTEGER ); CREATE TABLE department( Dname...
Find the names of departments that are located in Houston.
SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston'
2,135
company_1
CREATE TABLE works_on( Essn INTEGER, Pno INTEGER, Hours REAL, PRIMARY KEY( Essn, Pno ) ); CREATE TABLE employee( Fname TEXT, Minit TEXT, Lname TEXT, Ssn INTEGER PRIMARY KEY, Bdate TEXT, Address TEXT, Sex TEXT, Salary INTEGER, Super_ssn INTEGER, Dno INTEGER ); CREATE TABLE department( Dname...
Return the first names and last names of employees who earn more than 30000 in salary.
SELECT fname , lname FROM employee WHERE salary > 30000
2,136
company_1
CREATE TABLE works_on( Essn INTEGER, Pno INTEGER, Hours REAL, PRIMARY KEY( Essn, Pno ) ); CREATE TABLE employee( Fname TEXT, Minit TEXT, Lname TEXT, Ssn INTEGER PRIMARY KEY, Bdate TEXT, Address TEXT, Sex TEXT, Salary INTEGER, Super_ssn INTEGER, Dno INTEGER ); CREATE TABLE department( Dname...
Find the number of employees of each gender whose salary is lower than 50000.
SELECT count(*) , sex FROM employee WHERE salary < 50000 GROUP BY sex
2,137
company_1
CREATE TABLE works_on( Essn INTEGER, Pno INTEGER, Hours REAL, PRIMARY KEY( Essn, Pno ) ); CREATE TABLE employee( Fname TEXT, Minit TEXT, Lname TEXT, Ssn INTEGER PRIMARY KEY, Bdate TEXT, Address TEXT, Sex TEXT, Salary INTEGER, Super_ssn INTEGER, Dno INTEGER ); CREATE TABLE department( Dname...
list the first and last names, and the addresses of all employees in the ascending order of their birth date.
SELECT fname , lname , address FROM employee ORDER BY Bdate
2,138
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
what are the event details of the services that have the type code 'Marriage'?
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'
2,139
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
What are the ids and details of events that have more than one participants?
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
2,140
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
How many events have each participants attended? List the participant id, type and the number.
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
2,141
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
What are all the the participant ids, type code and details?
SELECT Participant_ID , Participant_Type_Code , Participant_Details FROM Participants
2,142
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
How many participants belong to the type 'Organizer'?
SELECT count(*) FROM participants WHERE participant_type_code = 'Organizer'
2,143
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
List the type of the services in alphabetical order.
SELECT service_type_code FROM services ORDER BY service_type_code
2,144
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
List the service id and details for the events.
SELECT service_id , event_details FROM EVENTS
2,145
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
How many events had participants whose details had the substring 'Dr.'
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.%'
2,146
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
What is the most common participant type?
SELECT participant_type_code FROM participants GROUP BY participant_type_code ORDER BY count(*) DESC LIMIT 1
2,147
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
Which service id and type has the least number of participants?
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
2,148
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
What is the id of the event with the most participants?
SELECT Event_ID FROM Participants_in_Events GROUP BY Event_ID ORDER BY count(*) DESC LIMIT 1
2,149
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
Which events id does not have any participant with detail 'Kenyatta Kuhn'?
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'
2,150
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
Which services type had both successful and failure event details?
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'
2,151
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
How many events did not have any participants?
SELECT count(*) FROM EVENTS WHERE event_id NOT IN (SELECT event_id FROM Participants_in_Events)
2,152
local_govt_in_alabama
CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR( 15 ) NOT NULL, PRIMARY KEY ( Service_ID ) ); CREATE TABLE Participants ( Participant_ID INTEGER NOT NULL, Participant_Type_Code CHAR( 15 ) NOT NULL, Participant_Details VARCHAR( 255 ), PRIMARY KEY ( Participant_...
What are all the distinct participant ids who attended any events?
SELECT count(DISTINCT participant_id) FROM participants_in_Events
2,153
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the name of the race held most recently?
SELECT name FROM races ORDER BY date DESC LIMIT 1
2,154
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the name of the race that occurred most recently?
SELECT name FROM races ORDER BY date DESC LIMIT 1
2,155
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the name and date of the most recent race?
SELECT name , date FROM races ORDER BY date DESC LIMIT 1
2,156
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the name and date of the race that occurred most recently?
SELECT name , date FROM races ORDER BY date DESC LIMIT 1
2,157
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
Find the names of all races held in 2017.
SELECT name FROM races WHERE YEAR = 2017
2,158
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the names of all the races that occurred in the year 2017?
SELECT name FROM races WHERE YEAR = 2017
2,159
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
Find the distinct names of all races held between 2014 and 2017?
SELECT DISTINCT name FROM races WHERE YEAR BETWEEN 2014 AND 2017
2,160
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the unique names of all race held between 2014 and 2017?
SELECT DISTINCT name FROM races WHERE YEAR BETWEEN 2014 AND 2017
2,161
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
List the forename and surname of all distinct drivers who once had laptime less than 93000 milliseconds?
SELECT DISTINCT T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds < 93000
2,162
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the forenames and surnames of all unique drivers who had a lap time of less than 93000 milliseconds?
SELECT DISTINCT T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds < 93000
2,163
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
Find all the distinct id and nationality of drivers who have had laptime more than 100000 milliseconds?
SELECT DISTINCT T1.driverid , T1.nationality FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds > 100000
2,164
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the different driver ids and nationalities of all drivers who had a laptime of more than 100000 milliseconds?
SELECT DISTINCT T1.driverid , T1.nationality FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds > 100000
2,165
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the forename and surname of the driver who has the smallest laptime?
SELECT T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds LIMIT 1
2,166
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the forename and surname of the driver with the shortest laptime?
SELECT T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid ORDER BY T2.milliseconds LIMIT 1
2,167
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the id and family name of the driver who has the longest laptime?
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
2,168
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the id and last name of the driver with the longest laptime?
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
2,169
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the id, forname and surname of the driver who had the first position in terms of laptime at least twice?
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
2,170
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the id, first name, and last name of the driver who was in the first position for laptime at least twice?
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
2,171
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
How many drivers participated in the race Australian Grand Prix held in 2009?
SELECT count(*) FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid WHERE T2.name = "Australian Grand Prix" AND YEAR = 2009
2,172
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
How many drivers were in the Australian Grand Prix held in 2009?
SELECT count(*) FROM results AS T1 JOIN races AS T2 ON T1.raceid = T2.raceid WHERE T2.name = "Australian Grand Prix" AND YEAR = 2009
2,173
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
How many drivers did not participate in the races held in 2009?
SELECT count(DISTINCT driverId) FROM results WHERE raceId NOT IN( SELECT raceId FROM races WHERE YEAR != 2009 )
2,174
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
How many drivers did not race in 2009?
SELECT count(DISTINCT driverId) FROM results WHERE raceId NOT IN( SELECT raceId FROM races WHERE YEAR != 2009 )
2,175
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
Give me a list of names and years of races that had any driver whose forename is Lewis?
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"
2,176
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the names and years of all races that had a driver with the last name Lewis?
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"
2,177
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
Find the forename and surname of drivers whose nationality is German?
SELECT forename , surname FROM drivers WHERE nationality = "German"
2,178
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the first and last name of all the German drivers?
SELECT forename , surname FROM drivers WHERE nationality = "German"
2,179
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
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?
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...
2,180
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What is the id and first name of all the drivers who participated in the Australian Grand Prix and the Chinese Grand Prix?
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...
2,181
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
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?
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...
2,182
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the first and last names of all drivers who participated in the Australian Grand Prix but not the Chinese Grand Prix?
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...
2,183
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
Find all the forenames of distinct drivers who was in position 1 as standing and won?
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
2,184
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are all the different first names of the drivers who are in position as standing and won?
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
2,185
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
Find all the forenames of distinct drivers who won in position 1 as driver standing and had more than 20 points?
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
2,186
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the first names of the different drivers who won in position 1 as driver standing and had more than 20 points?
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
2,187
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the numbers of constructors for different nationalities?
SELECT count(*) , nationality FROM constructors GROUP BY nationality
2,188
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
For each nationality, how many different constructors are there?
SELECT count(*) , nationality FROM constructors GROUP BY nationality
2,189
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the numbers of races for each constructor id?
SELECT count(*) , constructorid FROM constructorStandings GROUP BY constructorid
2,190
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
For each constructor id, how many races are there?
SELECT count(*) , constructorid FROM constructorStandings GROUP BY constructorid
2,191
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the names of races that were held after 2017 and the circuits were in the country of Spain?
SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = "Spain" AND T1.year > 2017
2,192
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the names of the races held after 2017 in Spain?
SELECT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = "Spain" AND T1.year > 2017
2,193
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the unique names of races that held after 2000 and the circuits were in Spain?
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
2,194
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
What are the names of all races held after 2000 in Spain?
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
2,195
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
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.
SELECT DISTINCT driverid , STOP FROM pitstops WHERE duration < (SELECT max(duration) FROM pitstops WHERE raceid = 841)
2,196
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
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?
SELECT DISTINCT driverid , STOP FROM pitstops WHERE duration < (SELECT max(duration) FROM pitstops WHERE raceid = 841)
2,197
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
Find the distinct driver id of all drivers that have a longer stop duration than some drivers in the race whose id is 841?
SELECT DISTINCT driverid , STOP FROM pitstops WHERE duration > (SELECT min(duration) FROM pitstops WHERE raceid = 841)
2,198
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
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?
SELECT DISTINCT driverid , STOP FROM pitstops WHERE duration > (SELECT min(duration) FROM pitstops WHERE raceid = 841)
2,199
formula_1
CREATE TABLE "circuits" ( "circuitId" INTEGER PRIMARY KEY, "circuitRef" TEXT, "name" TEXT, "location" TEXT, "country" TEXT, "lat" REAL, "lng" REAL, "alt" TEXT, "url" TEXT ); CREATE TABLE "races" ( "raceId" INTEGER PRIMARY KEY, "year" INTEGER, "round" INTEGER, "circuitId" INTEGER, "na...
List the forenames of all distinct drivers in alphabetical order?
SELECT DISTINCT forename FROM drivers ORDER BY forename ASC