schema
stringlengths
144
5.45k
question
stringlengths
16
224
query
stringlengths
18
577
hardness
stringclasses
5 values
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is the id for the employee called Ebba?
SELECT employee_ID FROM Employees WHERE employee_name = "Ebba"
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the id of the employee named Ebba.
SELECT employee_ID FROM Employees WHERE employee_name = "Ebba"
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the names of all the employees with role "HR".
SELECT employee_name FROM Employees WHERE role_code = "HR"
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Which employees have the role with code "HR"? Find their names.
SELECT employee_name FROM Employees WHERE role_code = "HR"
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show all role codes and the number of employees in each role.
SELECT role_code , count(*) FROM Employees GROUP BY role_code
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is the code of each role and the number of employees in each role?
SELECT role_code , count(*) FROM Employees GROUP BY role_code
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is the role code with the largest number of employees?
SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Find the code of the role that have the most employees.
SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show all role codes with at least 3 employees.
SELECT role_code FROM Employees GROUP BY role_code HAVING count(*) >= 3
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the roles with three or more employees? Give me the role codes.
SELECT role_code FROM Employees GROUP BY role_code HAVING count(*) >= 3
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the role code with the least employees.
SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) ASC LIMIT 1
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is the role with the smallest number of employees? Find the role codes.
SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) ASC LIMIT 1
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is the role name and role description for employee called Ebba?
SELECT T2.role_name , T2.role_description FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T1.employee_name = "Ebba"
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the name and description of the role played by the employee named Ebba.
SELECT T2.role_name , T2.role_description FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T1.employee_name = "Ebba"
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the names of employees with role name Editor.
SELECT T1.employee_name FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = "Editor"
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Find the names of all the employees whose the role name is "Editor".
SELECT T1.employee_name FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = "Editor"
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the employee ids for all employees with role name "Human Resource" or "Manager".
SELECT T1.employee_id FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = "Human Resource" OR T2.role_name = "Manager"
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the employee ids of the employees whose role name is "Human Resource" or "Manager"?
SELECT T1.employee_id FROM Employees AS T1 JOIN ROLES AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = "Human Resource" OR T2.role_name = "Manager"
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the different location codes for documents?
SELECT DISTINCT location_code FROM Document_locations
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Give me all the distinct location codes for documents.
SELECT DISTINCT location_code FROM Document_locations
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the location name for document "Robin CV".
SELECT T3.location_name FROM All_documents AS T1 JOIN Document_locations AS T2 ON T1.document_id = T2.document_id JOIN Ref_locations AS T3 ON T2.location_code = T3.location_code WHERE T1.document_name = "Robin CV"
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is the location name of the document "Robin CV"?
SELECT T3.location_name FROM All_documents AS T1 JOIN Document_locations AS T2 ON T1.document_id = T2.document_id JOIN Ref_locations AS T3 ON T2.location_code = T3.location_code WHERE T1.document_name = "Robin CV"
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the location code, the starting date and ending data in that location for all the documents.
SELECT location_code , date_in_location_from , date_in_locaton_to FROM Document_locations
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are each document's location code, and starting date and ending data in that location?
SELECT location_code , date_in_location_from , date_in_locaton_to FROM Document_locations
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is "the date in location from" and "the date in location to" for the document with name "Robin CV"?
SELECT T1.date_in_location_from , T1.date_in_locaton_to FROM Document_locations AS T1 JOIN All_documents AS T2 ON T1.document_id = T2.document_id WHERE T2.document_name = "Robin CV"
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Find the starting date and ending data in location for the document named "Robin CV".
SELECT T1.date_in_location_from , T1.date_in_locaton_to FROM Document_locations AS T1 JOIN All_documents AS T2 ON T1.document_id = T2.document_id WHERE T2.document_name = "Robin CV"
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the location codes and the number of documents in each location.
SELECT location_code , count(*) FROM Document_locations GROUP BY location_code
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is the code of each location and the number of documents in that location?
SELECT location_code , count(*) FROM Document_locations GROUP BY location_code
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What is the location code with the most documents?
SELECT location_code FROM Document_locations GROUP BY location_code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Find the code of the location with the largest number of documents.
SELECT location_code FROM Document_locations GROUP BY location_code ORDER BY count(*) DESC LIMIT 1
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the location codes with at least 3 documents.
SELECT location_code FROM Document_locations GROUP BY location_code HAVING count(*) >= 3
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the codes of the locations with at least three documents?
SELECT location_code FROM Document_locations GROUP BY location_code HAVING count(*) >= 3
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the location name and code with the least documents.
SELECT T2.location_name , T1.location_code FROM Document_locations AS T1 JOIN Ref_locations AS T2 ON T1.location_code = T2.location_code GROUP BY T1.location_code ORDER BY count(*) ASC LIMIT 1
extra
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the name and code of the location with the smallest number of documents?
SELECT T2.location_name , T1.location_code FROM Document_locations AS T1 JOIN Ref_locations AS T2 ON T1.location_code = T2.location_code GROUP BY T1.location_code ORDER BY count(*) ASC LIMIT 1
extra
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the names of the employees who authorised the destruction and the employees who destroyed the corresponding documents?
SELECT T2.employee_name , T3.employee_name FROM Documents_to_be_destroyed AS T1 JOIN Employees AS T2 ON T1.Destruction_Authorised_by_Employee_ID = T2.employee_id JOIN Employees AS T3 ON T1.Destroyed_by_Employee_ID = T3.employee_id;
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
List the names of the employees who authorized the destruction of documents and the employees who destroyed the corresponding documents.
SELECT T2.employee_name , T3.employee_name FROM Documents_to_be_destroyed AS T1 JOIN Employees AS T2 ON T1.Destruction_Authorised_by_Employee_ID = T2.employee_id JOIN Employees AS T3 ON T1.Destroyed_by_Employee_ID = T3.employee_id;
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the id of each employee and the number of document destruction authorised by that employee.
SELECT Destruction_Authorised_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destruction_Authorised_by_Employee_ID
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the id of each employee and the number of document destruction authorised by that employee?
SELECT Destruction_Authorised_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destruction_Authorised_by_Employee_ID
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the employee ids and the number of documents destroyed by each employee.
SELECT Destroyed_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destroyed_by_Employee_ID
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the id of each employee and the number of document destroyed by that employee?
SELECT Destroyed_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destroyed_by_Employee_ID
medium
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the ids of the employees who don't authorize destruction for any document.
SELECT employee_id FROM Employees EXCEPT SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Which employees do not authorize destruction for any document? Give me their employee ids.
SELECT employee_id FROM Employees EXCEPT SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the ids of all employees who have authorized destruction.
SELECT DISTINCT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the ids of all the employees who authorize document destruction?
SELECT DISTINCT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the ids of all employees who have destroyed a document.
SELECT DISTINCT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
What are the ids of all the employees who have destroyed documents?
SELECT DISTINCT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed
easy
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the ids of all employees who don't destroy any document.
SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Which employees do not destroy any document? Find their employee ids.
SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Show the ids of all employees who have either destroyed a document or made an authorization to do this.
SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed UNION SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
hard
CREATE TABLE Ref_Document_Types (Document_Type_Code text, Document_Type_Name text, Document_Type_Description text); CREATE TABLE Ref_Calendar (Calendar_Date time, Day_Number number); CREATE TABLE Ref_Locations (Location_Code text, Location_Name text, Location_Description text); CREATE TABLE Roles (Role_Code text, Role_Name text, Role_Description text); CREATE TABLE All_Documents (Document_ID number, Date_Stored time, Document_Type_Code text, Document_Name text, Document_Description text, Other_Details text); CREATE TABLE Employees (Employee_ID number, Role_Code text, Employee_Name text, Gender_MFU text, Date_of_Birth time, Other_Details text); CREATE TABLE Document_Locations (Document_ID number, Location_Code text, Date_in_Location_From time, Date_in_Locaton_To time); CREATE TABLE Documents_to_be_Destroyed (Document_ID number, Destruction_Authorised_by_Employee_ID number, Destroyed_by_Employee_ID number, Planned_Destruction_Date time, Actual_Destruction_Date time, Other_Details text);
Which employees have either destroyed a document or made an authorization to do so? Return their employee ids.
SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed UNION SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
How many clubs are there?
SELECT count(*) FROM club
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Count the total number of clubs.
SELECT count(*) FROM club
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
What are the names of all clubs?
SELECT clubname FROM club
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Give me the name of each club.
SELECT clubname FROM club
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
How many students are there?
SELECT count(*) FROM student
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Count the total number of students.
SELECT count(*) FROM student
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
What are the first names of all the students?
SELECT DISTINCT fname FROM student
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find each student's first name.
SELECT DISTINCT fname FROM student
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the last names of the members of the club "Bootup Baltimore".
SELECT t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Who are the members of the club named "Bootup Baltimore"? Give me their last names.
SELECT t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Who are the members of the club named "Hopkins Student Enterprises"? Show the last name.
SELECT t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Return the last name for the members of the club named "Hopkins Student Enterprises".
SELECT t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
How many members does the club "Tennis Club" has?
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Tennis Club"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Count the members of the club "Tennis Club".
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Tennis Club"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the number of members of club "Pen and Paper Gaming".
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Pen and Paper Gaming"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
How many people have membership in the club "Pen and Paper Gaming"?
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Pen and Paper Gaming"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
How many clubs does "Linda Smith" belong to?
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Linda" AND t3.lname = "Smith"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
How many clubs does "Linda Smith" have membership for?
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Linda" AND t3.lname = "Smith"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the number of clubs where "Tracy Kim" is a member.
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Tracy" AND t3.lname = "Kim"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
For how many clubs is "Tracy Kim" a member?
SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = "Tracy" AND t3.lname = "Kim"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find all the female members of club "Bootup Baltimore". Show the first name and last name.
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t3.sex = "F"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Give me the first name and last name for all the female members of the club "Bootup Baltimore".
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t3.sex = "F"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find all the male members of club "Hopkins Student Enterprises". Show the first name and last name.
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises" AND t3.sex = "M"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
What are the first name and last name of each male member in club "Hopkins Student Enterprises"?
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises" AND t3.sex = "M"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find all members of "Bootup Baltimore" whose major is "600". Show the first name and last name.
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t3.major = "600"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Which members of "Bootup Baltimore" major in "600"? Give me their first names and last names.
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t3.major = "600"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Which club has the most members majoring in "600"?
SELECT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.major = "600" GROUP BY t1.clubname ORDER BY count(*) DESC LIMIT 1
extra
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the club which has the largest number of members majoring in "600".
SELECT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.major = "600" GROUP BY t1.clubname ORDER BY count(*) DESC LIMIT 1
extra
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the name of the club that has the most female students.
SELECT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.sex = "F" GROUP BY t1.clubname ORDER BY count(*) DESC LIMIT 1
extra
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Which club has the most female students as their members? Give me the name of the club.
SELECT t1.clubname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.sex = "F" GROUP BY t1.clubname ORDER BY count(*) DESC LIMIT 1
extra
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
What is the description of the club named "Tennis Club"?
SELECT clubdesc FROM club WHERE clubname = "Tennis Club"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the description of the club called "Tennis Club".
SELECT clubdesc FROM club WHERE clubname = "Tennis Club"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the description of the club "Pen and Paper Gaming".
SELECT clubdesc FROM club WHERE clubname = "Pen and Paper Gaming"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
What is the description of the club "Pen and Paper Gaming"?
SELECT clubdesc FROM club WHERE clubname = "Pen and Paper Gaming"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
What is the location of the club named "Tennis Club"?
SELECT clublocation FROM club WHERE clubname = "Tennis Club"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Where us the club named "Tennis Club" located?
SELECT clublocation FROM club WHERE clubname = "Tennis Club"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the location of the club "Pen and Paper Gaming".
SELECT clublocation FROM club WHERE clubname = "Pen and Paper Gaming"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Where is the club "Pen and Paper Gaming" located?
SELECT clublocation FROM club WHERE clubname = "Pen and Paper Gaming"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Where is the club "Hopkins Student Enterprises" located?
SELECT clublocation FROM club WHERE clubname = "Hopkins Student Enterprises"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Tell me the location of the club "Hopkins Student Enterprises".
SELECT clublocation FROM club WHERE clubname = "Hopkins Student Enterprises"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the name of all the clubs at "AKW".
SELECT clubname FROM club WHERE clublocation = "AKW"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Which clubs are located at "AKW"? Return the club names.
SELECT clubname FROM club WHERE clublocation = "AKW"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
How many clubs are located at "HHH"?
SELECT count(*) FROM club WHERE clublocation = "HHH"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Count the number of clubs located at "HHH".
SELECT count(*) FROM club WHERE clublocation = "HHH"
easy
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
What are the first and last name of the president of the club "Bootup Baltimore"?
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t2.position = "President"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Who is the president of the club "Bootup Baltimore"? Give me the first and last name.
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore" AND t2.position = "President"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Who is the "CTO" of club "Hopkins Student Enterprises"? Show the first name and last name.
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises" AND t2.position = "CTO"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Find the first name and last name for the "CTO" of the club "Hopkins Student Enterprises"?
SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Hopkins Student Enterprises" AND t2.position = "CTO"
hard
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
How many different roles are there in the club "Bootup Baltimore"?
SELECT count(DISTINCT t2.position) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid WHERE t1.clubname = "Bootup Baltimore"
medium
CREATE TABLE Student (StuID number, LName text, Fname text, Age number, Sex text, Major number, Advisor number, city_code text); CREATE TABLE Club (ClubID number, ClubName text, ClubDesc text, ClubLocation text); CREATE TABLE Member_of_club (StuID number, ClubID number, Position text);
Count the number of different positions in the club "Bootup Baltimore".
SELECT count(DISTINCT t2.position) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid WHERE t1.clubname = "Bootup Baltimore"
medium