db_id
stringclasses
127 values
query
stringlengths
20
523
question
stringlengths
16
224
schema
stringclasses
127 values
cre_Doc_Tracking_DB
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"
Show the location name for document "Robin CV".
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
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"
What is the location name of the document "Robin CV"?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT location_code , date_in_location_from , date_in_locaton_to FROM Document_locations
Show the location code, the starting date and ending data in that location for all the documents.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT location_code , date_in_location_from , date_in_locaton_to FROM Document_locations
What are each document's location code, and starting date and ending data in that location?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
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"
What is "the date in location from" and "the date in location to" for the document with name "Robin CV"?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
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"
Find the starting date and ending data in location for the document named "Robin CV".
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT location_code , count(*) FROM Document_locations GROUP BY location_code
Show the location codes and the number of documents in each location.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT location_code , count(*) FROM Document_locations GROUP BY location_code
What is the code of each location and the number of documents in that location?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT location_code FROM Document_locations GROUP BY location_code ORDER BY count(*) DESC LIMIT 1
What is the location code with the most documents?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT location_code FROM Document_locations GROUP BY location_code ORDER BY count(*) DESC LIMIT 1
Find the code of the location with the largest number of documents.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT location_code FROM Document_locations GROUP BY location_code HAVING count(*) >= 3
Show the location codes with at least 3 documents.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT location_code FROM Document_locations GROUP BY location_code HAVING count(*) >= 3
What are the codes of the locations with at least three documents?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
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
Show the location name and code with the least documents.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
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
What are the name and code of the location with the smallest number of documents?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
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;
What are the names of the employees who authorised the destruction and the employees who destroyed the corresponding documents?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
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;
List the names of the employees who authorized the destruction of documents and the employees who destroyed the corresponding documents.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT Destruction_Authorised_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destruction_Authorised_by_Employee_ID
Show the id of each employee and the number of document destruction authorised by that employee.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT Destruction_Authorised_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destruction_Authorised_by_Employee_ID
What are the id of each employee and the number of document destruction authorised by that employee?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT Destroyed_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destroyed_by_Employee_ID
Show the employee ids and the number of documents destroyed by each employee.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT Destroyed_by_Employee_ID , count(*) FROM Documents_to_be_destroyed GROUP BY Destroyed_by_Employee_ID
What are the id of each employee and the number of document destroyed by that employee?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT employee_id FROM Employees EXCEPT SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
Show the ids of the employees who don't authorize destruction for any document.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT employee_id FROM Employees EXCEPT SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
Which employees do not authorize destruction for any document? Give me their employee ids.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT DISTINCT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
Show the ids of all employees who have authorized destruction.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT DISTINCT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
What are the ids of all the employees who authorize document destruction?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT DISTINCT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed
Show the ids of all employees who have destroyed a document.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT DISTINCT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed
What are the ids of all the employees who have destroyed documents?
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed
Show the ids of all employees who don't destroy any document.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed
Which employees do not destroy any document? Find their employee ids.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed UNION SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
Show the ids of all employees who have either destroyed a document or made an authorization to do this.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
cre_Doc_Tracking_DB
SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed UNION SELECT Destruction_Authorised_by_Employee_ID FROM Documents_to_be_destroyed
Which employees have either destroyed a document or made an authorization to do so? Return their employee ids.
PRAGMA foreign_keys = ON; CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15) NOT NULL, Document_Type_Name VARCHAR(255) NOT NULL, Document_Type_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Document_Type_Code) ); CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME NOT NULL, Day_Number INTEGER, PRIMARY KEY (Calendar_Date) ); CREATE TABLE Ref_Locations ( Location_Code CHAR(15) NOT NULL, Location_Name VARCHAR(255) NOT NULL, Location_Description VARCHAR(255) NOT NULL, PRIMARY KEY (Location_Code) ); CREATE TABLE Roles ( Role_Code CHAR(15) NOT NULL, Role_Name VARCHAR(255), Role_Description VARCHAR(255), PRIMARY KEY (Role_Code) ); CREATE TABLE All_Documents ( Document_ID INTEGER NOT NULL, Date_Stored DATETIME, Document_Type_Code CHAR(15) NOT NULL, Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code), FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date) ); CREATE TABLE Employees ( Employee_ID INTEGER NOT NULL, Role_Code CHAR(15) NOT NULL, Employee_Name VARCHAR(255), Gender_MFU CHAR(1) NOT NULL, Date_of_Birth DATETIME NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Employee_ID), FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code) ); CREATE TABLE Document_Locations ( Document_ID INTEGER NOT NULL, Location_Code CHAR(15) NOT NULL, Date_in_Location_From DATETIME NOT NULL, Date_in_Locaton_To DATETIME, PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From), FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code), FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER NOT NULL, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date DATETIME, Actual_Destruction_Date DATETIME, Other_Details VARCHAR(255), PRIMARY KEY (Document_ID), FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID), FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date), FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID) ); INSERT INTO Ref_Calendar (`Calendar_Date`, `Day_Number`) VALUES ('1972-03-31 09:47:22', 5)INSERT INTO Ref_Document_Types (`Document_Type_Code`, `Document_Type_Name`, `Document_Type_Description`) VALUES ('CV', 'CV', '')INSERT INTO Ref_Locations (`Location_Code`, `Location_Name`, `Location_Description`) VALUES ('b', 'Brazil', '')INSERT INTO Roles (`Role_Code`, `Role_Name`, `Role_Description`) VALUES ('MG', 'Manager', 'Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.')INSERT INTO Employees (`Employee_ID`, `Role_Code`, `Employee_Name`, `Gender_MFU`, `Date_of_Birth`, `Other_Details`) VALUES (25, 'HR', 'Leo', '', '1973-02-15 17:16:00', NULL)INSERT INTO All_Documents (`Document_ID`, `Date_Stored`, `Document_Type_Code`, `Document_Name`, `Document_Description`, `Other_Details`) VALUES (7, '1976-06-15 03:40:06', 'CV', 'Robin CV', NULL, NULL)INSERT INTO Document_Locations (`Document_ID`, `Location_Code`, `Date_in_Location_From`, `Date_in_Locaton_To`) VALUES (7, 'e', '2017-01-06 23:17:22', '2008-06-08 12:45:38')INSERT INTO Documents_to_be_Destroyed (`Document_ID`, `Destruction_Authorised_by_Employee_ID`, `Destroyed_by_Employee_ID`, `Planned_Destruction_Date`, `Actual_Destruction_Date`, `Other_Details`) VALUES (7, 156, 138, '1988-02-01 14:41:52', '2017-01-06 23:17:22', NULL)
club_1
SELECT count(*) FROM club
How many clubs are there?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT count(*) FROM club
Count the total number of clubs.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clubname FROM club
What are the names of all clubs?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clubname FROM club
Give me the name of each club.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT count(*) FROM student
How many students are there?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT count(*) FROM student
Count the total number of students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT fname FROM student
What are the first names of all the students?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT fname FROM student
Find each student's first name.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Find the last names of the members of the club "Bootup Baltimore".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Who are the members of the club named "Bootup Baltimore"? Give me their last names.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Who are the members of the club named "Hopkins Student Enterprises"? Show the last name.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Return the last name for the members of the club named "Hopkins Student Enterprises".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
How many members does the club "Tennis Club" has?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Count the members of the club "Tennis Club".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Find the number of members of club "Pen and Paper Gaming".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
How many people have membership in the club "Pen and Paper Gaming"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
How many clubs does "Linda Smith" belong to?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
How many clubs does "Linda Smith" have membership for?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Find the number of clubs where "Tracy Kim" is a member.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
For how many clubs is "Tracy Kim" a member?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Find all the female members of club "Bootup Baltimore". Show the first name and last name.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Give me the first name and last name for all the female members of the club "Bootup Baltimore".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Find all the male members of club "Hopkins Student Enterprises". Show the first name and last name.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
What are the first name and last name of each male member in club "Hopkins Student Enterprises"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Find all members of "Bootup Baltimore" whose major is "600". Show the first name and last name.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Which members of "Bootup Baltimore" major in "600"? Give me their first names and last names.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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
Which club has the most members majoring in "600"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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
Find the club which has the largest number of members majoring in "600".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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
Find the name of the club that has the most female students.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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
Which club has the most female students as their members? Give me the name of the club.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clubdesc FROM club WHERE clubname = "Tennis Club"
What is the description of the club named "Tennis Club"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clubdesc FROM club WHERE clubname = "Tennis Club"
Find the description of the club called "Tennis Club".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clubdesc FROM club WHERE clubname = "Pen and Paper Gaming"
Find the description of the club "Pen and Paper Gaming".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clubdesc FROM club WHERE clubname = "Pen and Paper Gaming"
What is the description of the club "Pen and Paper Gaming"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clublocation FROM club WHERE clubname = "Tennis Club"
What is the location of the club named "Tennis Club"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clublocation FROM club WHERE clubname = "Tennis Club"
Where us the club named "Tennis Club" located?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clublocation FROM club WHERE clubname = "Pen and Paper Gaming"
Find the location of the club "Pen and Paper Gaming".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clublocation FROM club WHERE clubname = "Pen and Paper Gaming"
Where is the club "Pen and Paper Gaming" located?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clublocation FROM club WHERE clubname = "Hopkins Student Enterprises"
Where is the club "Hopkins Student Enterprises" located?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clublocation FROM club WHERE clubname = "Hopkins Student Enterprises"
Tell me the location of the club "Hopkins Student Enterprises".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clubname FROM club WHERE clublocation = "AKW"
Find the name of all the clubs at "AKW".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT clubname FROM club WHERE clublocation = "AKW"
Which clubs are located at "AKW"? Return the club names.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT count(*) FROM club WHERE clublocation = "HHH"
How many clubs are located at "HHH"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT count(*) FROM club WHERE clublocation = "HHH"
Count the number of clubs located at "HHH".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
What are the first and last name of the president of the club "Bootup Baltimore"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Who is the president of the club "Bootup Baltimore"? Give me the first and last name.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Who is the "CTO" of club "Hopkins Student Enterprises"? Show the first name and last name.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Find the first name and last name for the "CTO" of the club "Hopkins Student Enterprises"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
How many different roles are there in the club "Bootup Baltimore"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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"
Count the number of different positions in the club "Bootup Baltimore".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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 = "Bootup Baltimore" AND t3.age > 18
How many members of "Bootup Baltimore" are older than 18?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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 = "Bootup Baltimore" AND t3.age > 18
Count the number of members in club "Bootup Baltimore" whose age is above 18.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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 = "Bootup Baltimore" AND t3.age < 18
How many members of club "Bootup Baltimore" are younger than 18?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
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 = "Bootup Baltimore" AND t3.age < 18
Count the number of members in club "Bootup Baltimore" whose age is below 18.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT 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.city_code = "BAL"
Find the names of all the clubs that have at least a member from the city with city code "BAL".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT 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.city_code = "BAL"
Which clubs have one or more members from the city with code "BAL"? Give me the names of the clubs.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT 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.city_code = "HOU"
Find the names of the clubs that have at least a member from the city with city code "HOU".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT 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.city_code = "HOU"
Which clubs have one or more members from the city with code "HOU"? Give me the names of the clubs.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT count(DISTINCT 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.fname = "Eric" AND t3.lname = "Tai"
How many clubs does the student named "Eric Tai" belong to?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT count(DISTINCT 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.fname = "Eric" AND t3.lname = "Tai"
Count the number of clubs for which the student named "Eric Tai" is a member.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT 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.fname = "Davis" AND t3.lname = "Steven"
List the clubs having "Davis Steven" as a member.
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT 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.fname = "Davis" AND t3.lname = "Steven"
What are the names of the clubs that have "Davis Steven" as a member?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT 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.advisor = 1121
List the clubs that have at least a member with advisor "1121".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT DISTINCT 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.advisor = 1121
Which clubs have one or more members whose advisor is "1121"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT avg(t3.age) 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"
What is the average age of the members of the club "Bootup Baltimore"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT avg(t3.age) 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"
Find the average age of the members in the club "Bootup Baltimore".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT avg(t3.age) 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"
Find the average age of members of the club "Hopkins Student Enterprises".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT avg(t3.age) 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"
On average, how old are the members in the club "Hopkins Student Enterprises"?
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT avg(t3.age) 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"
Retrieve the average age of members of the club "Tennis Club".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]
club_1
SELECT avg(t3.age) 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"
Compute the average age of the members in the club "Tennis Club".
create table Student ( StuID INTEGER PRIMARY KEY, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ); create table Club ( ClubID INTEGER PRIMARY KEY, ClubName VARCHAR(40), ClubDesc VARCHAR(1024), ClubLocation VARCHAR(40) ); create table Member_of_club ( StuID INTEGER, ClubID INTEGER, Position VARCHAR(40), FOREIGN KEY(StuID) REFERENCES Student(StuID), FOREIGN KEY(ClubID) REFERENCES Club(ClubID) ); insert into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL'); insert into Club values ( 1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'); insert into Member_of_club values ( 1001, 1, 'President'); INSERT INTO Student VALUES [(1001, 'Smith', 'Linda', 18, 'F', 600, 1121, 'BAL'), (1002, 'Kim', 'Tracy', 19, 'F', 600, 7712, 'HKG')] INSERT INTO Club VALUES [(1, 'Bootup Baltimore', 'Refurbish computers; teach kids and adults about computer basics.', 'AKW'), (2, 'Hopkins Student Enterprises', 'Venture capital fund for student business.', 'AKW')] INSERT INTO Member_of_club VALUES [(1001, 1, 'President'), (1007, 4, 'Vice-President')]