db_id
stringclasses
39 values
schema
stringclasses
39 values
question_en
stringlengths
22
155
hardness
stringclasses
4 values
schema_llm
stringclasses
39 values
query_llm
stringlengths
25
430
selector
stringlengths
21
191
schema_llm_ct
stringclasses
39 values
schema_llm_columns_min
stringclasses
39 values
schema_llm_columns_min_ct
stringclasses
39 values
schema_llm_all_min
stringclasses
39 values
schema_llm_all_min_ct
stringclasses
39 values
schema_dict
stringclasses
39 values
selector_correct
stringlengths
21
191
schema_llm_t
stringclasses
39 values
schema_llm_columns_min_t
stringclasses
39 values
schema_llm_all_min_t
stringclasses
39 values
cre_Doc_Workflow
CREATE TABLE "Authors" ( author_name VARCHAR(255) NOT NULL, other_details VARCHAR(255) NOT NULL, PRIMARY KEY (author_name) ) CREATE TABLE "Business_Processes" ( process_id INTEGER NOT NULL, next_process_id INTEGER, process_name VARCHAR(255) NOT NULL, process_description VARCHAR(255) NOT NULL, other_details VARCHAR(255), PRIMARY KEY (process_id) ) CREATE TABLE "Documents" ( document_id INTEGER NOT NULL, author_name VARCHAR(255) NOT NULL, document_name VARCHAR(255) NOT NULL, document_description VARCHAR(255) NOT NULL, other_details VARCHAR(255), PRIMARY KEY (document_id), FOREIGN KEY(author_name) REFERENCES "Authors" (author_name) ) CREATE TABLE "Documents_Processes" ( document_id INTEGER NOT NULL, process_id INTEGER NOT NULL, process_outcome_code CHAR(15) NOT NULL, process_status_code CHAR(15) NOT NULL, PRIMARY KEY (document_id, process_id), FOREIGN KEY(document_id) REFERENCES "Documents" (document_id), FOREIGN KEY(process_id) REFERENCES "Business_Processes" (process_id), FOREIGN KEY(process_outcome_code) REFERENCES "Process_Outcomes" (process_outcome_code), FOREIGN KEY(process_status_code) REFERENCES "Process_Status" (process_status_code) ) CREATE TABLE "Process_Outcomes" ( process_outcome_code CHAR(15) NOT NULL, process_outcome_description VARCHAR(255) NOT NULL, PRIMARY KEY (process_outcome_code) ) CREATE TABLE "Process_Status" ( process_status_code CHAR(15) NOT NULL, process_status_description VARCHAR(255) NOT NULL, PRIMARY KEY (process_status_code) ) CREATE TABLE "Ref_Staff_Roles" ( staff_role_code CHAR(15) NOT NULL, staff_role_description VARCHAR(255) NOT NULL, PRIMARY KEY (staff_role_code) ) CREATE TABLE "Staff" ( staff_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_in_Processes" ( document_id INTEGER NOT NULL, process_id INTEGER NOT NULL, staff_id INTEGER NOT NULL, staff_role_code CHAR(15) NOT NULL, date_from DATETIME, date_to DATETIME, other_details VARCHAR(255), PRIMARY KEY (document_id, process_id, staff_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(document_id, process_id) REFERENCES "Documents_Processes" (document_id, process_id), FOREIGN KEY(staff_role_code) REFERENCES "Ref_Staff_Roles" (staff_role_code) )
How many authors do we have?
easy
Table Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) Table Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) Table Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) Table Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) Table Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) Table Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) Table Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
SELECT count(*) FROM Authors
{ 'authors': ['author_name'] }
CREATE TABLE Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) CREATE TABLE Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) CREATE TABLE Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) CREATE TABLE Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) CREATE TABLE Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) CREATE TABLE Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) CREATE TABLE Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
Table Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) Table Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) Table Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) Table Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) Table Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) Table Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) Table Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
CREATE TABLE Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) CREATE TABLE Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) CREATE TABLE Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) CREATE TABLE Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) CREATE TABLE Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) CREATE TABLE Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) CREATE TABLE Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
Table authors ( authors.author_name (VARCHAR(255)), authors.other_details (VARCHAR(255)), ) Table business_processes ( business_processes.process_id (INTEGER), business_processes.next_process_id (INTEGER), business_processes.process_name (VARCHAR(255)), business_processes.process_description (VARCHAR(255)), business_processes.other_details (VARCHAR(255)), ) Table documents ( documents.document_id (INTEGER), documents.author_name (VARCHAR(255)), documents.document_name (VARCHAR(255)), documents.document_description (VARCHAR(255)), documents.other_details (VARCHAR(255)), ) Table documents_processes ( documents_processes.document_id (INTEGER), documents_processes.process_id (INTEGER), documents_processes.process_outcome_code (CHAR(15)), documents_processes.process_status_code (CHAR(15)), ) Table process_outcomes ( process_outcomes.process_outcome_code (CHAR(15)), process_outcomes.process_outcome_description (VARCHAR(255)), ) Table process_status ( process_status.process_status_code (CHAR(15)), process_status.process_status_description (VARCHAR(255)), ) Table ref_staff_roles ( ref_staff_roles.staff_role_code (CHAR(15)), ref_staff_roles.staff_role_description (VARCHAR(255)), ) Table staff ( staff.staff_id (INTEGER), staff.staff_details (VARCHAR(255)), ) Table staff_in_processes ( staff_in_processes.document_id (INTEGER), staff_in_processes.process_id (INTEGER), staff_in_processes.staff_id (INTEGER), staff_in_processes.staff_role_code (CHAR(15)), staff_in_processes.date_from (DATETIME), staff_in_processes.date_to (DATETIME), staff_in_processes.other_details (VARCHAR(255)), ) Possible JOINs: documents.author_name = authors.author_name documents_processes.document_id = documents.document_id documents_processes.process_id = business_processes.process_id documents_processes.process_outcome_code = process_outcomes.process_outcome_code documents_processes.process_status_code = process_status.process_status_code staff_in_processes.document_id = documents_processes.document_id staff_in_processes.process_id = documents_processes.process_id staff_in_processes.staff_id = staff.staff_id staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
CREATE TABLE authors ( authors.author_name (VARCHAR(255)), authors.other_details (VARCHAR(255)), ) CREATE TABLE business_processes ( business_processes.process_id (INTEGER), business_processes.next_process_id (INTEGER), business_processes.process_name (VARCHAR(255)), business_processes.process_description (VARCHAR(255)), business_processes.other_details (VARCHAR(255)), ) CREATE TABLE documents ( documents.document_id (INTEGER), documents.author_name (VARCHAR(255)), documents.document_name (VARCHAR(255)), documents.document_description (VARCHAR(255)), documents.other_details (VARCHAR(255)), ) CREATE TABLE documents_processes ( documents_processes.document_id (INTEGER), documents_processes.process_id (INTEGER), documents_processes.process_outcome_code (CHAR(15)), documents_processes.process_status_code (CHAR(15)), ) CREATE TABLE process_outcomes ( process_outcomes.process_outcome_code (CHAR(15)), process_outcomes.process_outcome_description (VARCHAR(255)), ) CREATE TABLE process_status ( process_status.process_status_code (CHAR(15)), process_status.process_status_description (VARCHAR(255)), ) CREATE TABLE ref_staff_roles ( ref_staff_roles.staff_role_code (CHAR(15)), ref_staff_roles.staff_role_description (VARCHAR(255)), ) CREATE TABLE staff ( staff.staff_id (INTEGER), staff.staff_details (VARCHAR(255)), ) CREATE TABLE staff_in_processes ( staff_in_processes.document_id (INTEGER), staff_in_processes.process_id (INTEGER), staff_in_processes.staff_id (INTEGER), staff_in_processes.staff_role_code (CHAR(15)), staff_in_processes.date_from (DATETIME), staff_in_processes.date_to (DATETIME), staff_in_processes.other_details (VARCHAR(255)), ) Possible JOINs: documents.author_name = authors.author_name documents_processes.document_id = documents.document_id documents_processes.process_id = business_processes.process_id documents_processes.process_outcome_code = process_outcomes.process_outcome_code documents_processes.process_status_code = process_status.process_status_code staff_in_processes.document_id = documents_processes.document_id staff_in_processes.process_id = documents_processes.process_id staff_in_processes.staff_id = staff.staff_id staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
{ 'Staff': ['staff_id', 'staff_details'], 'Ref_Staff_Roles': ['staff_role_code', 'staff_role_description'], 'Process_Outcomes': ['process_outcome_code', 'process_outcome_description'], 'Process_Status': ['process_status_code', 'process_status_description'], 'Authors': ['author_name', 'other_details'], 'Documents': ['document_id', 'author_name', 'document_name', 'document_description', 'other_details'], 'Business_Processes': ['process_id', 'next_process_id', 'process_name', 'process_description', 'other_details'], 'Documents_Processes': ['document_id', 'process_id', 'process_outcome_code', 'process_status_code'], 'Staff_in_Processes': ['document_id', 'process_id', 'staff_id', 'staff_role_code', 'date_from', 'date_to', 'other_details'] }
{ 'Authors': ['author_name'] }
TABLE Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) TABLE Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) TABLE Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) TABLE Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) TABLE Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) TABLE Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) TABLE Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
TABLE Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) TABLE Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) TABLE Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) TABLE Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) TABLE Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) TABLE Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) TABLE Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
TABLE authors ( authors.author_name (VARCHAR(255)), authors.other_details (VARCHAR(255)), ) TABLE business_processes ( business_processes.process_id (INTEGER), business_processes.next_process_id (INTEGER), business_processes.process_name (VARCHAR(255)), business_processes.process_description (VARCHAR(255)), business_processes.other_details (VARCHAR(255)), ) TABLE documents ( documents.document_id (INTEGER), documents.author_name (VARCHAR(255)), documents.document_name (VARCHAR(255)), documents.document_description (VARCHAR(255)), documents.other_details (VARCHAR(255)), ) TABLE documents_processes ( documents_processes.document_id (INTEGER), documents_processes.process_id (INTEGER), documents_processes.process_outcome_code (CHAR(15)), documents_processes.process_status_code (CHAR(15)), ) TABLE process_outcomes ( process_outcomes.process_outcome_code (CHAR(15)), process_outcomes.process_outcome_description (VARCHAR(255)), ) TABLE process_status ( process_status.process_status_code (CHAR(15)), process_status.process_status_description (VARCHAR(255)), ) TABLE ref_staff_roles ( ref_staff_roles.staff_role_code (CHAR(15)), ref_staff_roles.staff_role_description (VARCHAR(255)), ) TABLE staff ( staff.staff_id (INTEGER), staff.staff_details (VARCHAR(255)), ) TABLE staff_in_processes ( staff_in_processes.document_id (INTEGER), staff_in_processes.process_id (INTEGER), staff_in_processes.staff_id (INTEGER), staff_in_processes.staff_role_code (CHAR(15)), staff_in_processes.date_from (DATETIME), staff_in_processes.date_to (DATETIME), staff_in_processes.other_details (VARCHAR(255)), ) Possible JOINs: documents.author_name = authors.author_name documents_processes.document_id = documents.document_id documents_processes.process_id = business_processes.process_id documents_processes.process_outcome_code = process_outcomes.process_outcome_code documents_processes.process_status_code = process_status.process_status_code staff_in_processes.document_id = documents_processes.document_id staff_in_processes.process_id = documents_processes.process_id staff_in_processes.staff_id = staff.staff_id staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
real_estate_rentals
CREATE TABLE "Addresses" ( address_id INTEGER, line_1_number_building VARCHAR(80), line_2_number_street VARCHAR(80), line_3_area_locality VARCHAR(80), town_city VARCHAR(80), zip_postcode VARCHAR(20), county_state_province VARCHAR(80), country VARCHAR(50), other_address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Features" ( feature_id INTEGER, feature_name VARCHAR(80), feature_description VARCHAR(80), PRIMARY KEY (feature_id) ) CREATE TABLE "Properties" ( property_id INTEGER, property_address_id INTEGER NOT NULL, owner_user_id INTEGER NOT NULL, property_type_code VARCHAR(15) NOT NULL, date_on_market DATETIME, date_off_market DATETIME, property_name VARCHAR(80), property_description VARCHAR(255), garage_yn VARCHAR(1), parking_lots VARCHAR(1), room_count VARCHAR(10), vendor_requested_price DOUBLE, price_min DOUBLE, price_max DOUBLE, other_property_details VARCHAR(255), PRIMARY KEY (property_id), FOREIGN KEY(property_type_code) REFERENCES "Ref_Property_Types" (property_type_code), FOREIGN KEY(property_address_id) REFERENCES "Addresses" (address_id), FOREIGN KEY(owner_user_id) REFERENCES "Users" (user_id) ) CREATE TABLE "Property_Features" ( property_id INTEGER NOT NULL, feature_id INTEGER NOT NULL, feature_value VARCHAR(80), property_feature_description VARCHAR(80), FOREIGN KEY(property_id) REFERENCES "Properties" (property_id), FOREIGN KEY(feature_id) REFERENCES "Features" (feature_id) ) CREATE TABLE "Property_Photos" ( property_id INTEGER NOT NULL, photo_seq INTEGER NOT NULL, photo_title VARCHAR(30), photo_description VARCHAR(255), photo_filename VARCHAR(255), FOREIGN KEY(property_id) REFERENCES "Properties" (property_id) ) CREATE TABLE "Ref_Age_Categories" ( age_category_code VARCHAR(15), age_category_description VARCHAR(80), PRIMARY KEY (age_category_code) ) CREATE TABLE "Ref_Property_Types" ( property_type_code VARCHAR(15), property_type_description VARCHAR(80), PRIMARY KEY (property_type_code) ) CREATE TABLE "Ref_Room_Types" ( room_type_code VARCHAR(15), room_type_description VARCHAR(80), PRIMARY KEY (room_type_code) ) CREATE TABLE "Ref_User_Categories" ( user_category_code VARCHAR(15), user_category_description VARCHAR(80), PRIMARY KEY (user_category_code) ) CREATE TABLE "Rooms" ( property_id INTEGER NOT NULL, room_number VARCHAR(10) NOT NULL, room_type_code VARCHAR(15) NOT NULL, room_size VARCHAR(20), other_room_details VARCHAR(255), FOREIGN KEY(room_type_code) REFERENCES "Ref_Room_Types" (room_type_code), FOREIGN KEY(property_id) REFERENCES "Properties" (property_id) ) CREATE TABLE "User_Property_History" ( user_id INTEGER NOT NULL, property_id INTEGER NOT NULL, datestamp DATETIME NOT NULL, FOREIGN KEY(property_id) REFERENCES "Properties" (property_id), FOREIGN KEY(user_id) REFERENCES "Users" (user_id) ) CREATE TABLE "User_Searches" ( user_id INTEGER NOT NULL, search_seq INTEGER NOT NULL, search_datetime DATETIME, search_string VARCHAR(80), FOREIGN KEY(user_id) REFERENCES "Users" (user_id) ) CREATE TABLE "Users" ( user_id INTEGER, age_category_code VARCHAR(15), user_category_code VARCHAR(15), user_address_id INTEGER NOT NULL, is_buyer VARCHAR(1), is_seller VARCHAR(1), login_name VARCHAR(25), password VARCHAR(8), date_registered DATETIME, first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), other_user_details VARCHAR(255), PRIMARY KEY (user_id) )
In which country does the user with first name Robbie live?
medium
Table Addresses ( Addresses.address_id (INTEGER), Addresses.line_1_number_building (VARCHAR(80)), Addresses.line_2_number_street (VARCHAR(80)), Addresses.line_3_area_locality (VARCHAR(80)), Addresses.town_city (VARCHAR(80)), Addresses.zip_postcode (VARCHAR(20)), Addresses.county_state_province (VARCHAR(80)), Addresses.country (VARCHAR(50)), Addresses.other_address_details (VARCHAR(255)), ) Table Features ( Features.feature_id (INTEGER), Features.feature_name (VARCHAR(80)), Features.feature_description (VARCHAR(80)), ) Table Properties ( Properties.property_id (INTEGER), Properties.property_address_id (INTEGER), Properties.owner_user_id (INTEGER), Properties.property_type_code (VARCHAR(15)), Properties.date_on_market (DATETIME), Properties.date_off_market (DATETIME), Properties.property_name (VARCHAR(80)), Properties.property_description (VARCHAR(255)), Properties.garage_yn (VARCHAR(1)), Properties.parking_lots (VARCHAR(1)), Properties.room_count (VARCHAR(10)), Properties.vendor_requested_price (DOUBLE), Properties.price_min (DOUBLE), Properties.price_max (DOUBLE), Properties.other_property_details (VARCHAR(255)), ) Table Property_Features ( Property_Features.property_id (INTEGER), Property_Features.feature_id (INTEGER), Property_Features.feature_value (VARCHAR(80)), Property_Features.property_feature_description (VARCHAR(80)), ) Table Property_Photos ( Property_Photos.property_id (INTEGER), Property_Photos.photo_seq (INTEGER), Property_Photos.photo_title (VARCHAR(30)), Property_Photos.photo_description (VARCHAR(255)), Property_Photos.photo_filename (VARCHAR(255)), ) Table Ref_Age_Categories ( Ref_Age_Categories.age_category_code (VARCHAR(15)), Ref_Age_Categories.age_category_description (VARCHAR(80)), ) Table Ref_Property_Types ( Ref_Property_Types.property_type_code (VARCHAR(15)), Ref_Property_Types.property_type_description (VARCHAR(80)), ) Table Ref_Room_Types ( Ref_Room_Types.room_type_code (VARCHAR(15)), Ref_Room_Types.room_type_description (VARCHAR(80)), ) Table Ref_User_Categories ( Ref_User_Categories.user_category_code (VARCHAR(15)), Ref_User_Categories.user_category_description (VARCHAR(80)), ) Table Rooms ( Rooms.property_id (INTEGER), Rooms.room_number (VARCHAR(10)), Rooms.room_type_code (VARCHAR(15)), Rooms.room_size (VARCHAR(20)), Rooms.other_room_details (VARCHAR(255)), ) Table User_Property_History ( User_Property_History.user_id (INTEGER), User_Property_History.property_id (INTEGER), User_Property_History.datestamp (DATETIME), ) Table User_Searches ( User_Searches.user_id (INTEGER), User_Searches.search_seq (INTEGER), User_Searches.search_datetime (DATETIME), User_Searches.search_string (VARCHAR(80)), ) Table Users ( Users.user_id (INTEGER), Users.age_category_code (VARCHAR(15)), Users.user_category_code (VARCHAR(15)), Users.user_address_id (INTEGER), Users.is_buyer (VARCHAR(1)), Users.is_seller (VARCHAR(1)), Users.login_name (VARCHAR(25)), Users.password (VARCHAR(8)), Users.date_registered (DATETIME), Users.first_name (VARCHAR(80)), Users.middle_name (VARCHAR(80)), Users.last_name (VARCHAR(80)), Users.other_user_details (VARCHAR(255)), ) Possible JOINs: Properties.property_address_id = Addresses.address_id Properties.owner_user_id = Users.user_id Properties.property_type_code = Ref_Property_Types.property_type_code Property_Features.property_id = Properties.property_id Property_Features.feature_id = Features.feature_id Property_Photos.property_id = Properties.property_id Rooms.property_id = Properties.property_id Rooms.room_type_code = Ref_Room_Types.room_type_code User_Property_History.user_id = Users.user_id User_Property_History.property_id = Properties.property_id User_Searches.user_id = Users.user_id
SELECT Addresses.country FROM Addresses JOIN Users ON Addresses.address_id = Users.user_address_id WHERE Users.first_name = 'Robbie';
{ 'addresses': ['address_id', 'country'], 'users': ['user_id', 'user_address_id', 'first_name'] }
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.line_1_number_building (VARCHAR(80)), Addresses.line_2_number_street (VARCHAR(80)), Addresses.line_3_area_locality (VARCHAR(80)), Addresses.town_city (VARCHAR(80)), Addresses.zip_postcode (VARCHAR(20)), Addresses.county_state_province (VARCHAR(80)), Addresses.country (VARCHAR(50)), Addresses.other_address_details (VARCHAR(255)), ) CREATE TABLE Features ( Features.feature_id (INTEGER), Features.feature_name (VARCHAR(80)), Features.feature_description (VARCHAR(80)), ) CREATE TABLE Properties ( Properties.property_id (INTEGER), Properties.property_address_id (INTEGER), Properties.owner_user_id (INTEGER), Properties.property_type_code (VARCHAR(15)), Properties.date_on_market (DATETIME), Properties.date_off_market (DATETIME), Properties.property_name (VARCHAR(80)), Properties.property_description (VARCHAR(255)), Properties.garage_yn (VARCHAR(1)), Properties.parking_lots (VARCHAR(1)), Properties.room_count (VARCHAR(10)), Properties.vendor_requested_price (DOUBLE), Properties.price_min (DOUBLE), Properties.price_max (DOUBLE), Properties.other_property_details (VARCHAR(255)), ) CREATE TABLE Property_Features ( Property_Features.property_id (INTEGER), Property_Features.feature_id (INTEGER), Property_Features.feature_value (VARCHAR(80)), Property_Features.property_feature_description (VARCHAR(80)), ) CREATE TABLE Property_Photos ( Property_Photos.property_id (INTEGER), Property_Photos.photo_seq (INTEGER), Property_Photos.photo_title (VARCHAR(30)), Property_Photos.photo_description (VARCHAR(255)), Property_Photos.photo_filename (VARCHAR(255)), ) CREATE TABLE Ref_Age_Categories ( Ref_Age_Categories.age_category_code (VARCHAR(15)), Ref_Age_Categories.age_category_description (VARCHAR(80)), ) CREATE TABLE Ref_Property_Types ( Ref_Property_Types.property_type_code (VARCHAR(15)), Ref_Property_Types.property_type_description (VARCHAR(80)), ) CREATE TABLE Ref_Room_Types ( Ref_Room_Types.room_type_code (VARCHAR(15)), Ref_Room_Types.room_type_description (VARCHAR(80)), ) CREATE TABLE Ref_User_Categories ( Ref_User_Categories.user_category_code (VARCHAR(15)), Ref_User_Categories.user_category_description (VARCHAR(80)), ) CREATE TABLE Rooms ( Rooms.property_id (INTEGER), Rooms.room_number (VARCHAR(10)), Rooms.room_type_code (VARCHAR(15)), Rooms.room_size (VARCHAR(20)), Rooms.other_room_details (VARCHAR(255)), ) CREATE TABLE User_Property_History ( User_Property_History.user_id (INTEGER), User_Property_History.property_id (INTEGER), User_Property_History.datestamp (DATETIME), ) CREATE TABLE User_Searches ( User_Searches.user_id (INTEGER), User_Searches.search_seq (INTEGER), User_Searches.search_datetime (DATETIME), User_Searches.search_string (VARCHAR(80)), ) CREATE TABLE Users ( Users.user_id (INTEGER), Users.age_category_code (VARCHAR(15)), Users.user_category_code (VARCHAR(15)), Users.user_address_id (INTEGER), Users.is_buyer (VARCHAR(1)), Users.is_seller (VARCHAR(1)), Users.login_name (VARCHAR(25)), Users.password (VARCHAR(8)), Users.date_registered (DATETIME), Users.first_name (VARCHAR(80)), Users.middle_name (VARCHAR(80)), Users.last_name (VARCHAR(80)), Users.other_user_details (VARCHAR(255)), ) Possible JOINs: Properties.property_address_id = Addresses.address_id Properties.owner_user_id = Users.user_id Properties.property_type_code = Ref_Property_Types.property_type_code Property_Features.property_id = Properties.property_id Property_Features.feature_id = Features.feature_id Property_Photos.property_id = Properties.property_id Rooms.property_id = Properties.property_id Rooms.room_type_code = Ref_Room_Types.room_type_code User_Property_History.user_id = Users.user_id User_Property_History.property_id = Properties.property_id User_Searches.user_id = Users.user_id
Table Addresses ( Addresses.address_id (INTEGER), Addresses.line_1_number_building (VARCHAR(80)), Addresses.line_2_number_street (VARCHAR(80)), Addresses.line_3_area_locality (VARCHAR(80)), Addresses.town_city (VARCHAR(80)), Addresses.zip_postcode (VARCHAR(20)), Addresses.county_state_province (VARCHAR(80)), Addresses.country (VARCHAR(50)), Addresses.other_address_details (VARCHAR(255)), ) Table Features ( Features.feature_id (INTEGER), Features.feature_name (VARCHAR(80)), Features.feature_description (VARCHAR(80)), ) Table Properties ( Properties.property_id (INTEGER), Properties.property_address_id (INTEGER), Properties.owner_user_id (INTEGER), Properties.property_type_code (VARCHAR(15)), Properties.date_on_market (DATETIME), Properties.date_off_market (DATETIME), Properties.property_name (VARCHAR(80)), Properties.property_description (VARCHAR(255)), Properties.garage_yn (VARCHAR(1)), Properties.parking_lots (VARCHAR(1)), Properties.room_count (VARCHAR(10)), Properties.vendor_requested_price (DOUBLE), Properties.price_min (DOUBLE), Properties.price_max (DOUBLE), Properties.other_property_details (VARCHAR(255)), ) Table Property_Features ( Property_Features.property_id (INTEGER), Property_Features.feature_id (INTEGER), Property_Features.feature_value (VARCHAR(80)), Property_Features.property_feature_description (VARCHAR(80)), ) Table Property_Photos ( Property_Photos.property_id (INTEGER), Property_Photos.photo_seq (INTEGER), Property_Photos.photo_title (VARCHAR(30)), Property_Photos.photo_description (VARCHAR(255)), Property_Photos.photo_filename (VARCHAR(255)), ) Table Ref_Age_Categories ( Ref_Age_Categories.age_category_code (VARCHAR(15)), Ref_Age_Categories.age_category_description (VARCHAR(80)), ) Table Ref_Property_Types ( Ref_Property_Types.property_type_code (VARCHAR(15)), Ref_Property_Types.property_type_description (VARCHAR(80)), ) Table Ref_Room_Types ( Ref_Room_Types.room_type_code (VARCHAR(15)), Ref_Room_Types.room_type_description (VARCHAR(80)), ) Table Ref_User_Categories ( Ref_User_Categories.user_category_code (VARCHAR(15)), Ref_User_Categories.user_category_description (VARCHAR(80)), ) Table Rooms ( Rooms.property_id (INTEGER), Rooms.room_number (VARCHAR(10)), Rooms.room_type_code (VARCHAR(15)), Rooms.room_size (VARCHAR(20)), Rooms.other_room_details (VARCHAR(255)), ) Table User_Property_History ( User_Property_History.user_id (INTEGER), User_Property_History.property_id (INTEGER), User_Property_History.datestamp (DATETIME), ) Table User_Searches ( User_Searches.user_id (INTEGER), User_Searches.search_seq (INTEGER), User_Searches.search_datetime (DATETIME), User_Searches.search_string (VARCHAR(80)), ) Table Users ( Users.user_id (INTEGER), Users.age_category_code (VARCHAR(15)), Users.user_category_code (VARCHAR(15)), Users.user_address_id (INTEGER), Users.is_buyer (VARCHAR(1)), Users.is_seller (VARCHAR(1)), Users.login_name (VARCHAR(25)), Users.password (VARCHAR(8)), Users.date_registered (DATETIME), Users.first_name (VARCHAR(80)), Users.middle_name (VARCHAR(80)), Users.last_name (VARCHAR(80)), Users.other_user_details (VARCHAR(255)), ) Possible JOINs: Properties.property_address_id = Addresses.address_id Properties.owner_user_id = Users.user_id Properties.property_type_code = Ref_Property_Types.property_type_code Property_Features.property_id = Properties.property_id Property_Features.feature_id = Features.feature_id Property_Photos.property_id = Properties.property_id Rooms.property_id = Properties.property_id Rooms.room_type_code = Ref_Room_Types.room_type_code User_Property_History.user_id = Users.user_id User_Property_History.property_id = Properties.property_id User_Searches.user_id = Users.user_id
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.line_1_number_building (VARCHAR(80)), Addresses.line_2_number_street (VARCHAR(80)), Addresses.line_3_area_locality (VARCHAR(80)), Addresses.town_city (VARCHAR(80)), Addresses.zip_postcode (VARCHAR(20)), Addresses.county_state_province (VARCHAR(80)), Addresses.country (VARCHAR(50)), Addresses.other_address_details (VARCHAR(255)), ) CREATE TABLE Features ( Features.feature_id (INTEGER), Features.feature_name (VARCHAR(80)), Features.feature_description (VARCHAR(80)), ) CREATE TABLE Properties ( Properties.property_id (INTEGER), Properties.property_address_id (INTEGER), Properties.owner_user_id (INTEGER), Properties.property_type_code (VARCHAR(15)), Properties.date_on_market (DATETIME), Properties.date_off_market (DATETIME), Properties.property_name (VARCHAR(80)), Properties.property_description (VARCHAR(255)), Properties.garage_yn (VARCHAR(1)), Properties.parking_lots (VARCHAR(1)), Properties.room_count (VARCHAR(10)), Properties.vendor_requested_price (DOUBLE), Properties.price_min (DOUBLE), Properties.price_max (DOUBLE), Properties.other_property_details (VARCHAR(255)), ) CREATE TABLE Property_Features ( Property_Features.property_id (INTEGER), Property_Features.feature_id (INTEGER), Property_Features.feature_value (VARCHAR(80)), Property_Features.property_feature_description (VARCHAR(80)), ) CREATE TABLE Property_Photos ( Property_Photos.property_id (INTEGER), Property_Photos.photo_seq (INTEGER), Property_Photos.photo_title (VARCHAR(30)), Property_Photos.photo_description (VARCHAR(255)), Property_Photos.photo_filename (VARCHAR(255)), ) CREATE TABLE Ref_Age_Categories ( Ref_Age_Categories.age_category_code (VARCHAR(15)), Ref_Age_Categories.age_category_description (VARCHAR(80)), ) CREATE TABLE Ref_Property_Types ( Ref_Property_Types.property_type_code (VARCHAR(15)), Ref_Property_Types.property_type_description (VARCHAR(80)), ) CREATE TABLE Ref_Room_Types ( Ref_Room_Types.room_type_code (VARCHAR(15)), Ref_Room_Types.room_type_description (VARCHAR(80)), ) CREATE TABLE Ref_User_Categories ( Ref_User_Categories.user_category_code (VARCHAR(15)), Ref_User_Categories.user_category_description (VARCHAR(80)), ) CREATE TABLE Rooms ( Rooms.property_id (INTEGER), Rooms.room_number (VARCHAR(10)), Rooms.room_type_code (VARCHAR(15)), Rooms.room_size (VARCHAR(20)), Rooms.other_room_details (VARCHAR(255)), ) CREATE TABLE User_Property_History ( User_Property_History.user_id (INTEGER), User_Property_History.property_id (INTEGER), User_Property_History.datestamp (DATETIME), ) CREATE TABLE User_Searches ( User_Searches.user_id (INTEGER), User_Searches.search_seq (INTEGER), User_Searches.search_datetime (DATETIME), User_Searches.search_string (VARCHAR(80)), ) CREATE TABLE Users ( Users.user_id (INTEGER), Users.age_category_code (VARCHAR(15)), Users.user_category_code (VARCHAR(15)), Users.user_address_id (INTEGER), Users.is_buyer (VARCHAR(1)), Users.is_seller (VARCHAR(1)), Users.login_name (VARCHAR(25)), Users.password (VARCHAR(8)), Users.date_registered (DATETIME), Users.first_name (VARCHAR(80)), Users.middle_name (VARCHAR(80)), Users.last_name (VARCHAR(80)), Users.other_user_details (VARCHAR(255)), ) Possible JOINs: Properties.property_address_id = Addresses.address_id Properties.owner_user_id = Users.user_id Properties.property_type_code = Ref_Property_Types.property_type_code Property_Features.property_id = Properties.property_id Property_Features.feature_id = Features.feature_id Property_Photos.property_id = Properties.property_id Rooms.property_id = Properties.property_id Rooms.room_type_code = Ref_Room_Types.room_type_code User_Property_History.user_id = Users.user_id User_Property_History.property_id = Properties.property_id User_Searches.user_id = Users.user_id
Table addresses ( addresses.address_id (INTEGER), addresses.line_1_number_building (VARCHAR(80)), addresses.line_2_number_street (VARCHAR(80)), addresses.line_3_area_locality (VARCHAR(80)), addresses.town_city (VARCHAR(80)), addresses.zip_postcode (VARCHAR(20)), addresses.county_state_province (VARCHAR(80)), addresses.country (VARCHAR(50)), addresses.other_address_details (VARCHAR(255)), ) Table features ( features.feature_id (INTEGER), features.feature_name (VARCHAR(80)), features.feature_description (VARCHAR(80)), ) Table properties ( properties.property_id (INTEGER), properties.property_address_id (INTEGER), properties.owner_user_id (INTEGER), properties.property_type_code (VARCHAR(15)), properties.date_on_market (DATETIME), properties.date_off_market (DATETIME), properties.property_name (VARCHAR(80)), properties.property_description (VARCHAR(255)), properties.garage_yn (VARCHAR(1)), properties.parking_lots (VARCHAR(1)), properties.room_count (VARCHAR(10)), properties.vendor_requested_price (DOUBLE), properties.price_min (DOUBLE), properties.price_max (DOUBLE), properties.other_property_details (VARCHAR(255)), ) Table property_features ( property_features.property_id (INTEGER), property_features.feature_id (INTEGER), property_features.feature_value (VARCHAR(80)), property_features.property_feature_description (VARCHAR(80)), ) Table property_photos ( property_photos.property_id (INTEGER), property_photos.photo_seq (INTEGER), property_photos.photo_title (VARCHAR(30)), property_photos.photo_description (VARCHAR(255)), property_photos.photo_filename (VARCHAR(255)), ) Table ref_age_categories ( ref_age_categories.age_category_code (VARCHAR(15)), ref_age_categories.age_category_description (VARCHAR(80)), ) Table ref_property_types ( ref_property_types.property_type_code (VARCHAR(15)), ref_property_types.property_type_description (VARCHAR(80)), ) Table ref_room_types ( ref_room_types.room_type_code (VARCHAR(15)), ref_room_types.room_type_description (VARCHAR(80)), ) Table ref_user_categories ( ref_user_categories.user_category_code (VARCHAR(15)), ref_user_categories.user_category_description (VARCHAR(80)), ) Table rooms ( rooms.property_id (INTEGER), rooms.room_number (VARCHAR(10)), rooms.room_type_code (VARCHAR(15)), rooms.room_size (VARCHAR(20)), rooms.other_room_details (VARCHAR(255)), ) Table user_property_history ( user_property_history.user_id (INTEGER), user_property_history.property_id (INTEGER), user_property_history.datestamp (DATETIME), ) Table user_searches ( user_searches.user_id (INTEGER), user_searches.search_seq (INTEGER), user_searches.search_datetime (DATETIME), user_searches.search_string (VARCHAR(80)), ) Table users ( users.user_id (INTEGER), users.age_category_code (VARCHAR(15)), users.user_category_code (VARCHAR(15)), users.user_address_id (INTEGER), users.is_buyer (VARCHAR(1)), users.is_seller (VARCHAR(1)), users.login_name (VARCHAR(25)), users.password (VARCHAR(8)), users.date_registered (DATETIME), users.first_name (VARCHAR(80)), users.middle_name (VARCHAR(80)), users.last_name (VARCHAR(80)), users.other_user_details (VARCHAR(255)), ) Possible JOINs: properties.property_address_id = addresses.address_id properties.owner_user_id = users.user_id properties.property_type_code = ref_property_types.property_type_code property_features.property_id = properties.property_id property_features.feature_id = features.feature_id property_photos.property_id = properties.property_id rooms.property_id = properties.property_id rooms.room_type_code = ref_room_types.room_type_code user_property_history.user_id = users.user_id user_property_history.property_id = properties.property_id user_searches.user_id = users.user_id
CREATE TABLE addresses ( addresses.address_id (INTEGER), addresses.line_1_number_building (VARCHAR(80)), addresses.line_2_number_street (VARCHAR(80)), addresses.line_3_area_locality (VARCHAR(80)), addresses.town_city (VARCHAR(80)), addresses.zip_postcode (VARCHAR(20)), addresses.county_state_province (VARCHAR(80)), addresses.country (VARCHAR(50)), addresses.other_address_details (VARCHAR(255)), ) CREATE TABLE features ( features.feature_id (INTEGER), features.feature_name (VARCHAR(80)), features.feature_description (VARCHAR(80)), ) CREATE TABLE properties ( properties.property_id (INTEGER), properties.property_address_id (INTEGER), properties.owner_user_id (INTEGER), properties.property_type_code (VARCHAR(15)), properties.date_on_market (DATETIME), properties.date_off_market (DATETIME), properties.property_name (VARCHAR(80)), properties.property_description (VARCHAR(255)), properties.garage_yn (VARCHAR(1)), properties.parking_lots (VARCHAR(1)), properties.room_count (VARCHAR(10)), properties.vendor_requested_price (DOUBLE), properties.price_min (DOUBLE), properties.price_max (DOUBLE), properties.other_property_details (VARCHAR(255)), ) CREATE TABLE property_features ( property_features.property_id (INTEGER), property_features.feature_id (INTEGER), property_features.feature_value (VARCHAR(80)), property_features.property_feature_description (VARCHAR(80)), ) CREATE TABLE property_photos ( property_photos.property_id (INTEGER), property_photos.photo_seq (INTEGER), property_photos.photo_title (VARCHAR(30)), property_photos.photo_description (VARCHAR(255)), property_photos.photo_filename (VARCHAR(255)), ) CREATE TABLE ref_age_categories ( ref_age_categories.age_category_code (VARCHAR(15)), ref_age_categories.age_category_description (VARCHAR(80)), ) CREATE TABLE ref_property_types ( ref_property_types.property_type_code (VARCHAR(15)), ref_property_types.property_type_description (VARCHAR(80)), ) CREATE TABLE ref_room_types ( ref_room_types.room_type_code (VARCHAR(15)), ref_room_types.room_type_description (VARCHAR(80)), ) CREATE TABLE ref_user_categories ( ref_user_categories.user_category_code (VARCHAR(15)), ref_user_categories.user_category_description (VARCHAR(80)), ) CREATE TABLE rooms ( rooms.property_id (INTEGER), rooms.room_number (VARCHAR(10)), rooms.room_type_code (VARCHAR(15)), rooms.room_size (VARCHAR(20)), rooms.other_room_details (VARCHAR(255)), ) CREATE TABLE user_property_history ( user_property_history.user_id (INTEGER), user_property_history.property_id (INTEGER), user_property_history.datestamp (DATETIME), ) CREATE TABLE user_searches ( user_searches.user_id (INTEGER), user_searches.search_seq (INTEGER), user_searches.search_datetime (DATETIME), user_searches.search_string (VARCHAR(80)), ) CREATE TABLE users ( users.user_id (INTEGER), users.age_category_code (VARCHAR(15)), users.user_category_code (VARCHAR(15)), users.user_address_id (INTEGER), users.is_buyer (VARCHAR(1)), users.is_seller (VARCHAR(1)), users.login_name (VARCHAR(25)), users.password (VARCHAR(8)), users.date_registered (DATETIME), users.first_name (VARCHAR(80)), users.middle_name (VARCHAR(80)), users.last_name (VARCHAR(80)), users.other_user_details (VARCHAR(255)), ) Possible JOINs: properties.property_address_id = addresses.address_id properties.owner_user_id = users.user_id properties.property_type_code = ref_property_types.property_type_code property_features.property_id = properties.property_id property_features.feature_id = features.feature_id property_photos.property_id = properties.property_id rooms.property_id = properties.property_id rooms.room_type_code = ref_room_types.room_type_code user_property_history.user_id = users.user_id user_property_history.property_id = properties.property_id user_searches.user_id = users.user_id
{ 'Ref_Age_Categories': ['age_category_code', 'age_category_description'], 'Ref_Property_Types': ['property_type_code', 'property_type_description'], 'Ref_Room_Types': ['room_type_code', 'room_type_description'], 'Ref_User_Categories': ['user_category_code', 'user_category_description'], 'Addresses': ['address_id', 'line_1_number_building', 'line_2_number_street', 'line_3_area_locality', 'town_city', 'zip_postcode', 'county_state_province', 'country', 'other_address_details'], 'Features': ['feature_id', 'feature_name', 'feature_description'], 'Users': ['user_id', 'age_category_code', 'user_category_code', 'user_address_id', 'is_buyer', 'is_seller', 'login_name', 'password', 'date_registered', 'first_name', 'middle_name', 'last_name', 'other_user_details'], 'Properties': ['property_id', 'property_address_id', 'owner_user_id', 'property_type_code', 'date_on_market', 'date_off_market', 'property_name', 'property_description', 'garage_yn', 'parking_lots', 'room_count', 'vendor_requested_price', 'price_min', 'price_max', 'other_property_details'], 'Property_Features': ['property_id', 'feature_id', 'feature_value', 'property_feature_description'], 'Property_Photos': ['property_id', 'photo_seq', 'photo_title', 'photo_description', 'photo_filename'], 'Rooms': ['property_id', 'room_number', 'room_type_code', 'room_size', 'other_room_details'], 'User_Property_History': ['user_id', 'property_id', 'datestamp'], 'User_Searches': ['user_id', 'search_seq', 'search_datetime', 'search_string'] }
{ 'Addresses': ['address_id', 'country'], 'Users': ['user_id', 'user_address_id', 'first_name'] }
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.line_1_number_building (VARCHAR(80)), Addresses.line_2_number_street (VARCHAR(80)), Addresses.line_3_area_locality (VARCHAR(80)), Addresses.town_city (VARCHAR(80)), Addresses.zip_postcode (VARCHAR(20)), Addresses.county_state_province (VARCHAR(80)), Addresses.country (VARCHAR(50)), Addresses.other_address_details (VARCHAR(255)), ) TABLE Features ( Features.feature_id (INTEGER), Features.feature_name (VARCHAR(80)), Features.feature_description (VARCHAR(80)), ) TABLE Properties ( Properties.property_id (INTEGER), Properties.property_address_id (INTEGER), Properties.owner_user_id (INTEGER), Properties.property_type_code (VARCHAR(15)), Properties.date_on_market (DATETIME), Properties.date_off_market (DATETIME), Properties.property_name (VARCHAR(80)), Properties.property_description (VARCHAR(255)), Properties.garage_yn (VARCHAR(1)), Properties.parking_lots (VARCHAR(1)), Properties.room_count (VARCHAR(10)), Properties.vendor_requested_price (DOUBLE), Properties.price_min (DOUBLE), Properties.price_max (DOUBLE), Properties.other_property_details (VARCHAR(255)), ) TABLE Property_Features ( Property_Features.property_id (INTEGER), Property_Features.feature_id (INTEGER), Property_Features.feature_value (VARCHAR(80)), Property_Features.property_feature_description (VARCHAR(80)), ) TABLE Property_Photos ( Property_Photos.property_id (INTEGER), Property_Photos.photo_seq (INTEGER), Property_Photos.photo_title (VARCHAR(30)), Property_Photos.photo_description (VARCHAR(255)), Property_Photos.photo_filename (VARCHAR(255)), ) TABLE Ref_Age_Categories ( Ref_Age_Categories.age_category_code (VARCHAR(15)), Ref_Age_Categories.age_category_description (VARCHAR(80)), ) TABLE Ref_Property_Types ( Ref_Property_Types.property_type_code (VARCHAR(15)), Ref_Property_Types.property_type_description (VARCHAR(80)), ) TABLE Ref_Room_Types ( Ref_Room_Types.room_type_code (VARCHAR(15)), Ref_Room_Types.room_type_description (VARCHAR(80)), ) TABLE Ref_User_Categories ( Ref_User_Categories.user_category_code (VARCHAR(15)), Ref_User_Categories.user_category_description (VARCHAR(80)), ) TABLE Rooms ( Rooms.property_id (INTEGER), Rooms.room_number (VARCHAR(10)), Rooms.room_type_code (VARCHAR(15)), Rooms.room_size (VARCHAR(20)), Rooms.other_room_details (VARCHAR(255)), ) TABLE User_Property_History ( User_Property_History.user_id (INTEGER), User_Property_History.property_id (INTEGER), User_Property_History.datestamp (DATETIME), ) TABLE User_Searches ( User_Searches.user_id (INTEGER), User_Searches.search_seq (INTEGER), User_Searches.search_datetime (DATETIME), User_Searches.search_string (VARCHAR(80)), ) TABLE Users ( Users.user_id (INTEGER), Users.age_category_code (VARCHAR(15)), Users.user_category_code (VARCHAR(15)), Users.user_address_id (INTEGER), Users.is_buyer (VARCHAR(1)), Users.is_seller (VARCHAR(1)), Users.login_name (VARCHAR(25)), Users.password (VARCHAR(8)), Users.date_registered (DATETIME), Users.first_name (VARCHAR(80)), Users.middle_name (VARCHAR(80)), Users.last_name (VARCHAR(80)), Users.other_user_details (VARCHAR(255)), ) Possible JOINs: Properties.property_address_id = Addresses.address_id Properties.owner_user_id = Users.user_id Properties.property_type_code = Ref_Property_Types.property_type_code Property_Features.property_id = Properties.property_id Property_Features.feature_id = Features.feature_id Property_Photos.property_id = Properties.property_id Rooms.property_id = Properties.property_id Rooms.room_type_code = Ref_Room_Types.room_type_code User_Property_History.user_id = Users.user_id User_Property_History.property_id = Properties.property_id User_Searches.user_id = Users.user_id
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.line_1_number_building (VARCHAR(80)), Addresses.line_2_number_street (VARCHAR(80)), Addresses.line_3_area_locality (VARCHAR(80)), Addresses.town_city (VARCHAR(80)), Addresses.zip_postcode (VARCHAR(20)), Addresses.county_state_province (VARCHAR(80)), Addresses.country (VARCHAR(50)), Addresses.other_address_details (VARCHAR(255)), ) TABLE Features ( Features.feature_id (INTEGER), Features.feature_name (VARCHAR(80)), Features.feature_description (VARCHAR(80)), ) TABLE Properties ( Properties.property_id (INTEGER), Properties.property_address_id (INTEGER), Properties.owner_user_id (INTEGER), Properties.property_type_code (VARCHAR(15)), Properties.date_on_market (DATETIME), Properties.date_off_market (DATETIME), Properties.property_name (VARCHAR(80)), Properties.property_description (VARCHAR(255)), Properties.garage_yn (VARCHAR(1)), Properties.parking_lots (VARCHAR(1)), Properties.room_count (VARCHAR(10)), Properties.vendor_requested_price (DOUBLE), Properties.price_min (DOUBLE), Properties.price_max (DOUBLE), Properties.other_property_details (VARCHAR(255)), ) TABLE Property_Features ( Property_Features.property_id (INTEGER), Property_Features.feature_id (INTEGER), Property_Features.feature_value (VARCHAR(80)), Property_Features.property_feature_description (VARCHAR(80)), ) TABLE Property_Photos ( Property_Photos.property_id (INTEGER), Property_Photos.photo_seq (INTEGER), Property_Photos.photo_title (VARCHAR(30)), Property_Photos.photo_description (VARCHAR(255)), Property_Photos.photo_filename (VARCHAR(255)), ) TABLE Ref_Age_Categories ( Ref_Age_Categories.age_category_code (VARCHAR(15)), Ref_Age_Categories.age_category_description (VARCHAR(80)), ) TABLE Ref_Property_Types ( Ref_Property_Types.property_type_code (VARCHAR(15)), Ref_Property_Types.property_type_description (VARCHAR(80)), ) TABLE Ref_Room_Types ( Ref_Room_Types.room_type_code (VARCHAR(15)), Ref_Room_Types.room_type_description (VARCHAR(80)), ) TABLE Ref_User_Categories ( Ref_User_Categories.user_category_code (VARCHAR(15)), Ref_User_Categories.user_category_description (VARCHAR(80)), ) TABLE Rooms ( Rooms.property_id (INTEGER), Rooms.room_number (VARCHAR(10)), Rooms.room_type_code (VARCHAR(15)), Rooms.room_size (VARCHAR(20)), Rooms.other_room_details (VARCHAR(255)), ) TABLE User_Property_History ( User_Property_History.user_id (INTEGER), User_Property_History.property_id (INTEGER), User_Property_History.datestamp (DATETIME), ) TABLE User_Searches ( User_Searches.user_id (INTEGER), User_Searches.search_seq (INTEGER), User_Searches.search_datetime (DATETIME), User_Searches.search_string (VARCHAR(80)), ) TABLE Users ( Users.user_id (INTEGER), Users.age_category_code (VARCHAR(15)), Users.user_category_code (VARCHAR(15)), Users.user_address_id (INTEGER), Users.is_buyer (VARCHAR(1)), Users.is_seller (VARCHAR(1)), Users.login_name (VARCHAR(25)), Users.password (VARCHAR(8)), Users.date_registered (DATETIME), Users.first_name (VARCHAR(80)), Users.middle_name (VARCHAR(80)), Users.last_name (VARCHAR(80)), Users.other_user_details (VARCHAR(255)), ) Possible JOINs: Properties.property_address_id = Addresses.address_id Properties.owner_user_id = Users.user_id Properties.property_type_code = Ref_Property_Types.property_type_code Property_Features.property_id = Properties.property_id Property_Features.feature_id = Features.feature_id Property_Photos.property_id = Properties.property_id Rooms.property_id = Properties.property_id Rooms.room_type_code = Ref_Room_Types.room_type_code User_Property_History.user_id = Users.user_id User_Property_History.property_id = Properties.property_id User_Searches.user_id = Users.user_id
TABLE addresses ( addresses.address_id (INTEGER), addresses.line_1_number_building (VARCHAR(80)), addresses.line_2_number_street (VARCHAR(80)), addresses.line_3_area_locality (VARCHAR(80)), addresses.town_city (VARCHAR(80)), addresses.zip_postcode (VARCHAR(20)), addresses.county_state_province (VARCHAR(80)), addresses.country (VARCHAR(50)), addresses.other_address_details (VARCHAR(255)), ) TABLE features ( features.feature_id (INTEGER), features.feature_name (VARCHAR(80)), features.feature_description (VARCHAR(80)), ) TABLE properties ( properties.property_id (INTEGER), properties.property_address_id (INTEGER), properties.owner_user_id (INTEGER), properties.property_type_code (VARCHAR(15)), properties.date_on_market (DATETIME), properties.date_off_market (DATETIME), properties.property_name (VARCHAR(80)), properties.property_description (VARCHAR(255)), properties.garage_yn (VARCHAR(1)), properties.parking_lots (VARCHAR(1)), properties.room_count (VARCHAR(10)), properties.vendor_requested_price (DOUBLE), properties.price_min (DOUBLE), properties.price_max (DOUBLE), properties.other_property_details (VARCHAR(255)), ) TABLE property_features ( property_features.property_id (INTEGER), property_features.feature_id (INTEGER), property_features.feature_value (VARCHAR(80)), property_features.property_feature_description (VARCHAR(80)), ) TABLE property_photos ( property_photos.property_id (INTEGER), property_photos.photo_seq (INTEGER), property_photos.photo_title (VARCHAR(30)), property_photos.photo_description (VARCHAR(255)), property_photos.photo_filename (VARCHAR(255)), ) TABLE ref_age_categories ( ref_age_categories.age_category_code (VARCHAR(15)), ref_age_categories.age_category_description (VARCHAR(80)), ) TABLE ref_property_types ( ref_property_types.property_type_code (VARCHAR(15)), ref_property_types.property_type_description (VARCHAR(80)), ) TABLE ref_room_types ( ref_room_types.room_type_code (VARCHAR(15)), ref_room_types.room_type_description (VARCHAR(80)), ) TABLE ref_user_categories ( ref_user_categories.user_category_code (VARCHAR(15)), ref_user_categories.user_category_description (VARCHAR(80)), ) TABLE rooms ( rooms.property_id (INTEGER), rooms.room_number (VARCHAR(10)), rooms.room_type_code (VARCHAR(15)), rooms.room_size (VARCHAR(20)), rooms.other_room_details (VARCHAR(255)), ) TABLE user_property_history ( user_property_history.user_id (INTEGER), user_property_history.property_id (INTEGER), user_property_history.datestamp (DATETIME), ) TABLE user_searches ( user_searches.user_id (INTEGER), user_searches.search_seq (INTEGER), user_searches.search_datetime (DATETIME), user_searches.search_string (VARCHAR(80)), ) TABLE users ( users.user_id (INTEGER), users.age_category_code (VARCHAR(15)), users.user_category_code (VARCHAR(15)), users.user_address_id (INTEGER), users.is_buyer (VARCHAR(1)), users.is_seller (VARCHAR(1)), users.login_name (VARCHAR(25)), users.password (VARCHAR(8)), users.date_registered (DATETIME), users.first_name (VARCHAR(80)), users.middle_name (VARCHAR(80)), users.last_name (VARCHAR(80)), users.other_user_details (VARCHAR(255)), ) Possible JOINs: properties.property_address_id = addresses.address_id properties.owner_user_id = users.user_id properties.property_type_code = ref_property_types.property_type_code property_features.property_id = properties.property_id property_features.feature_id = features.feature_id property_photos.property_id = properties.property_id rooms.property_id = properties.property_id rooms.room_type_code = ref_room_types.room_type_code user_property_history.user_id = users.user_id user_property_history.property_id = properties.property_id user_searches.user_id = users.user_id
institution_sports
CREATE TABLE "Championship" ( "Institution_ID" INTEGER, "Nickname" TEXT, "Joined" REAL, "Number_of_Championships" REAL, PRIMARY KEY ("Institution_ID"), FOREIGN KEY("Institution_ID") REFERENCES institution ("Institution_ID") ) CREATE TABLE institution ( "Institution_ID" INTEGER, "Name" TEXT, "Team" TEXT, "City" TEXT, "Province" TEXT, "Founded" REAL, "Affiliation" TEXT, "Enrollment" REAL, "Endowment" TEXT, "Stadium" TEXT, "Capacity" REAL, PRIMARY KEY ("Institution_ID") )
Give the stadium of the institution which is the greatest enrollment.
medium
Table Championship ( Championship.Institution_ID (INT), Championship.Nickname (TEXT), Championship.Joined (REAL), Championship.Number_of_Championships (REAL), ) Table institution ( institution.Institution_ID (INT), institution.Name (TEXT), institution.Team (TEXT), institution.City (TEXT), institution.Province (TEXT), institution.Founded (REAL), institution.Affiliation (TEXT), institution.Enrollment (REAL), institution.Endowment (TEXT), institution.Stadium (TEXT), institution.Capacity (REAL), ) Possible JOINs: Championship.Institution_ID = institution.Institution_ID
SELECT Stadium FROM institution ORDER BY Enrollment DESC LIMIT 1
{ 'institution': ['institution_id', 'enrollment', 'stadium'] }
CREATE TABLE Championship ( Championship.Institution_ID (INT), Championship.Nickname (TEXT), Championship.Joined (REAL), Championship.Number_of_Championships (REAL), ) CREATE TABLE institution ( institution.Institution_ID (INT), institution.Name (TEXT), institution.Team (TEXT), institution.City (TEXT), institution.Province (TEXT), institution.Founded (REAL), institution.Affiliation (TEXT), institution.Enrollment (REAL), institution.Endowment (TEXT), institution.Stadium (TEXT), institution.Capacity (REAL), ) Possible JOINs: Championship.Institution_ID = institution.Institution_ID
Table Championship ( Championship.institution_id (INT), Championship.nickname (TEXT), Championship.joined (REAL), Championship.number_of_championships (REAL), ) Table institution ( institution.institution_id (INT), institution.name (TEXT), institution.team (TEXT), institution.city (TEXT), institution.province (TEXT), institution.founded (REAL), institution.affiliation (TEXT), institution.enrollment (REAL), institution.endowment (TEXT), institution.stadium (TEXT), institution.capacity (REAL), ) Possible JOINs: Championship.institution_id = institution.institution_id
CREATE TABLE Championship ( Championship.institution_id (INT), Championship.nickname (TEXT), Championship.joined (REAL), Championship.number_of_championships (REAL), ) CREATE TABLE institution ( institution.institution_id (INT), institution.name (TEXT), institution.team (TEXT), institution.city (TEXT), institution.province (TEXT), institution.founded (REAL), institution.affiliation (TEXT), institution.enrollment (REAL), institution.endowment (TEXT), institution.stadium (TEXT), institution.capacity (REAL), ) Possible JOINs: Championship.institution_id = institution.institution_id
Table championship ( championship.institution_id (INT), championship.nickname (TEXT), championship.joined (REAL), championship.number_of_championships (REAL), ) Table institution ( institution.institution_id (INT), institution.name (TEXT), institution.team (TEXT), institution.city (TEXT), institution.province (TEXT), institution.founded (REAL), institution.affiliation (TEXT), institution.enrollment (REAL), institution.endowment (TEXT), institution.stadium (TEXT), institution.capacity (REAL), ) Possible JOINs: championship.institution_id = institution.institution_id
CREATE TABLE championship ( championship.institution_id (INT), championship.nickname (TEXT), championship.joined (REAL), championship.number_of_championships (REAL), ) CREATE TABLE institution ( institution.institution_id (INT), institution.name (TEXT), institution.team (TEXT), institution.city (TEXT), institution.province (TEXT), institution.founded (REAL), institution.affiliation (TEXT), institution.enrollment (REAL), institution.endowment (TEXT), institution.stadium (TEXT), institution.capacity (REAL), ) Possible JOINs: championship.institution_id = institution.institution_id
{ 'institution': ['Institution_ID', 'Name', 'Team', 'City', 'Province', 'Founded', 'Affiliation', 'Enrollment', 'Endowment', 'Stadium', 'Capacity'], 'Championship': ['Institution_ID', 'Nickname', 'Joined', 'Number_of_Championships'] }
{ 'institution': ['Institution_ID', 'Enrollment', 'Stadium'] }
TABLE Championship ( Championship.Institution_ID (INT), Championship.Nickname (TEXT), Championship.Joined (REAL), Championship.Number_of_Championships (REAL), ) TABLE institution ( institution.Institution_ID (INT), institution.Name (TEXT), institution.Team (TEXT), institution.City (TEXT), institution.Province (TEXT), institution.Founded (REAL), institution.Affiliation (TEXT), institution.Enrollment (REAL), institution.Endowment (TEXT), institution.Stadium (TEXT), institution.Capacity (REAL), ) Possible JOINs: Championship.Institution_ID = institution.Institution_ID
TABLE Championship ( Championship.institution_id (INT), Championship.nickname (TEXT), Championship.joined (REAL), Championship.number_of_championships (REAL), ) TABLE institution ( institution.institution_id (INT), institution.name (TEXT), institution.team (TEXT), institution.city (TEXT), institution.province (TEXT), institution.founded (REAL), institution.affiliation (TEXT), institution.enrollment (REAL), institution.endowment (TEXT), institution.stadium (TEXT), institution.capacity (REAL), ) Possible JOINs: Championship.institution_id = institution.institution_id
TABLE championship ( championship.institution_id (INT), championship.nickname (TEXT), championship.joined (REAL), championship.number_of_championships (REAL), ) TABLE institution ( institution.institution_id (INT), institution.name (TEXT), institution.team (TEXT), institution.city (TEXT), institution.province (TEXT), institution.founded (REAL), institution.affiliation (TEXT), institution.enrollment (REAL), institution.endowment (TEXT), institution.stadium (TEXT), institution.capacity (REAL), ) Possible JOINs: championship.institution_id = institution.institution_id
cre_Students_Information_Systems
CREATE TABLE Students ( `student_id` INTEGER NOT NULL, `bio_data` VARCHAR(255) NOT NULL, `student_details` VARCHAR(255) NOT NULL, PRIMARY KEY (`student_id`) ) /* 0 rows from Students table: student_id bio_data student_details */ CREATE TABLE Transcripts ( `transcript_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date_of_transcript` DATETIME(3), `transcript_details` VARCHAR(255) NOT NULL, PRIMARY KEY (`transcript_id`), FOREIGN KEY (student_id) REFERENCES Students (student_id) ) /* 0 rows from Transcripts table: transcript_id student_id date_of_transcript transcript_details */ CREATE TABLE Behaviour_Monitoring ( `behaviour_monitoring_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `behaviour_monitoring_details` VARCHAR(255) NOT NULL, PRIMARY KEY (`behaviour_monitoring_id`), FOREIGN KEY (student_id) REFERENCES Students (student_id) ) /* 0 rows from Behaviour_Monitoring table: behaviour_monitoring_id student_id behaviour_monitoring_details */ CREATE TABLE Addresses ( `address_id` INTEGER NOT NULL, `address_details` VARCHAR(255) NOT NULL, PRIMARY KEY (`address_id`) ) /* 0 rows from Addresses table: address_id address_details */ CREATE TABLE Ref_Event_Types ( `event_type_code` CHAR(10) NOT NULL, `event_type_description` VARCHAR(255) NOT NULL, PRIMARY KEY (`event_type_code`) ) /* 0 rows from Ref_Event_Types table: event_type_code event_type_description */ CREATE TABLE Ref_Achievement_Type ( `achievement_type_code` CHAR(15) NOT NULL, `achievement_type_description` VARCHAR(80), PRIMARY KEY (`achievement_type_code`) ) /* 0 rows from Ref_Achievement_Type table: achievement_type_code achievement_type_description */ CREATE TABLE Ref_Address_Types ( `address_type_code` CHAR(10) NOT NULL, `address_type_description` VARCHAR(255) NOT NULL, PRIMARY KEY (`address_type_code`) ) /* 0 rows from Ref_Address_Types table: address_type_code address_type_description */ CREATE TABLE Ref_Detention_Type ( `detention_type_code` CHAR(10) NOT NULL, `detention_type_description` VARCHAR(80), PRIMARY KEY (`detention_type_code`) ) /* 0 rows from Ref_Detention_Type table: detention_type_code detention_type_description */ CREATE TABLE Student_Events ( `event_id` INTEGER NOT NULL, `event_type_code` CHAR(10) NOT NULL, `student_id` INTEGER NOT NULL, `event_date` DATETIME(3), `other_details` VARCHAR(255) NOT NULL, PRIMARY KEY (`event_id`), FOREIGN KEY (student_id) REFERENCES Students (student_id), FOREIGN KEY (event_type_code) REFERENCES Ref_Event_Types (event_type_code) ) /* 0 rows from Student_Events table: event_id event_type_code student_id event_date other_details */ CREATE TABLE Teachers ( `teacher_id` INTEGER NOT NULL, `teacher_details` VARCHAR(255), PRIMARY KEY (`teacher_id`) ) /* 0 rows from Teachers table: teacher_id teacher_details */ CREATE TABLE Student_Loans ( `student_loan_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `date_of_loan` DATETIME(3), `amount_of_loan` DECIMAL(15,4), `other_details` VARCHAR(255), PRIMARY KEY (`student_loan_id`), FOREIGN KEY (student_id) REFERENCES Students (student_id) ) /* 0 rows from Student_Loans table: student_loan_id student_id date_of_loan amount_of_loan other_details */ CREATE TABLE Classes ( `class_id` INTEGER NOT NULL, `student_id` INTEGER NOT NULL, `teacher_id` INTEGER NOT NULL, `class_details` VARCHAR(255) NOT NULL, PRIMARY KEY (`class_id`), FOREIGN KEY (student_id) REFERENCES Students (student_id), FOREIGN KEY (teacher_id) REFERENCES Teachers (teacher_id) ) /* 0 rows from Classes table: class_id student_id teacher_id class_details */ CREATE TABLE Students_Addresses ( `student_address_id` INTEGER NOT NULL, `address_id` INTEGER NOT NULL, `address_type_code` CHAR(10) NOT NULL, `student_id` INTEGER NOT NULL, `date_from` DATETIME(3), `date_to` DATETIME(3), PRIMARY KEY (`student_address_id`), FOREIGN KEY (student_id) REFERENCES Students (student_id), FOREIGN KEY (address_id) REFERENCES Addresses (address_id), FOREIGN KEY (address_type_code) REFERENCES Ref_Address_Types (address_type_code) ) /* 0 rows from Students_Addresses table: student_address_id address_id address_type_code student_id date_from date_to */ CREATE TABLE Detention ( `detention_id` INTEGER NOT NULL, `detention_type_code` CHAR(10) NOT NULL, `student_id` INTEGER NOT NULL, `datetime_detention_start` DATETIME(3), `datetime_detention_end` DATETIME(3), `detention_summary` VARCHAR(255), `other_details` VARCHAR(255), PRIMARY KEY (`detention_id`), FOREIGN KEY (student_id) REFERENCES Students (student_id), FOREIGN KEY (detention_type_code) REFERENCES Ref_Detention_Type (detention_type_code) ) /* 0 rows from Detention table: detention_id detention_type_code student_id datetime_detention_start datetime_detention_end detention_summary other_details */ CREATE TABLE Achievements ( `achievement_id` INTEGER NOT NULL, `achievement_type_code` CHAR(15) NOT NULL, `student_id` INTEGER NOT NULL, `date_achievement` DATETIME(3), `achievement_details` VARCHAR(255), `other_details` VARCHAR(255), PRIMARY KEY (`achievement_id`), FOREIGN KEY (student_id) REFERENCES Students (student_id), FOREIGN KEY (achievement_type_code) REFERENCES Ref_Achievement_Type (achievement_type_code) ) /* 0 rows from Achievements table: achievement_id achievement_type_code student_id date_achievement achievement_details other_details */
List the details for all the pairs of teachers and students who are in the same class.
medium
Table Achievements ( Achievements.achievement_id (INTEGER), Achievements.achievement_type_code (CHAR(15)), Achievements.student_id (INTEGER), Achievements.date_achievement (DATETIME(3)), Achievements.achievement_details (VARCHAR(255)), Achievements.other_details (VARCHAR(255)), ) Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Behaviour_Monitoring ( Behaviour_Monitoring.behaviour_monitoring_id (INTEGER), Behaviour_Monitoring.student_id (INTEGER), Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)), ) Table Classes ( Classes.class_id (INTEGER), Classes.student_id (INTEGER), Classes.teacher_id (INTEGER), Classes.class_details (VARCHAR(255)), ) Table Detention ( Detention.detention_id (INTEGER), Detention.detention_type_code (CHAR(10)), Detention.student_id (INTEGER), Detention.datetime_detention_start (DATETIME(3)), Detention.datetime_detention_end (DATETIME(3)), Detention.detention_summary (VARCHAR(255)), Detention.other_details (VARCHAR(255)), ) Table Ref_Achievement_Type ( Ref_Achievement_Type.achievement_type_code (CHAR(15)), Ref_Achievement_Type.achievement_type_description (VARCHAR(80)), ) Table Ref_Address_Types ( Ref_Address_Types.address_type_code (CHAR(10)), Ref_Address_Types.address_type_description (VARCHAR(255)), ) Table Ref_Detention_Type ( Ref_Detention_Type.detention_type_code (CHAR(10)), Ref_Detention_Type.detention_type_description (VARCHAR(80)), ) Table Ref_Event_Types ( Ref_Event_Types.event_type_code (CHAR(10)), Ref_Event_Types.event_type_description (VARCHAR(255)), ) Table Student_Events ( Student_Events.event_id (INTEGER), Student_Events.event_type_code (CHAR(10)), Student_Events.student_id (INTEGER), Student_Events.event_date (DATETIME(3)), Student_Events.other_details (VARCHAR(255)), ) Table Student_Loans ( Student_Loans.student_loan_id (INTEGER), Student_Loans.student_id (INTEGER), Student_Loans.date_of_loan (DATETIME(3)), Student_Loans.amount_of_loan (DECIMAL(15,4)), Student_Loans.other_details (VARCHAR(255)), ) Table Students ( Students.student_id (INTEGER), Students.bio_data (VARCHAR(255)), Students.student_details (VARCHAR(255)), ) Table Students_Addresses ( Students_Addresses.student_address_id (INTEGER), Students_Addresses.address_id (INTEGER), Students_Addresses.address_type_code (CHAR(10)), Students_Addresses.student_id (INTEGER), Students_Addresses.date_from (DATETIME(3)), Students_Addresses.date_to (DATETIME(3)), ) Table Teachers ( Teachers.teacher_id (INTEGER), Teachers.teacher_details (VARCHAR(255)), ) Table Transcripts ( Transcripts.transcript_id (INTEGER), Transcripts.student_id (INTEGER), Transcripts.date_of_transcript (DATETIME(3)), Transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code Achievements.student_id = Students.student_id Behaviour_Monitoring.student_id = Students.student_id Classes.student_id = Students.student_id Classes.teacher_id = Teachers.teacher_id Detention.detention_type_code = Ref_Detention_Type.detention_type_code Detention.student_id = Students.student_id Student_Events.event_type_code = Ref_Event_Types.event_type_code Student_Events.student_id = Students.student_id Student_Loans.student_id = Students.student_id Students_Addresses.address_id = Addresses.address_id Students_Addresses.address_type_code = Ref_Address_Types.address_type_code Students_Addresses.student_id = Students.student_id Transcripts.student_id = Students.student_id
SELECT Teachers.teacher_details , Students.student_details FROM Teachers JOIN Classes ON Teachers.teacher_id = Classes.teacher_id JOIN Students ON Classes.student_id = Students.student_id
{ 'teachers': ['teacher_id', 'teacher_details'], 'classes': ['class_id', 'student_id', 'teacher_id'], 'students': ['student_id', 'student_details'] }
CREATE TABLE Achievements ( Achievements.achievement_id (INTEGER), Achievements.achievement_type_code (CHAR(15)), Achievements.student_id (INTEGER), Achievements.date_achievement (DATETIME(3)), Achievements.achievement_details (VARCHAR(255)), Achievements.other_details (VARCHAR(255)), ) CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Behaviour_Monitoring ( Behaviour_Monitoring.behaviour_monitoring_id (INTEGER), Behaviour_Monitoring.student_id (INTEGER), Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)), ) CREATE TABLE Classes ( Classes.class_id (INTEGER), Classes.student_id (INTEGER), Classes.teacher_id (INTEGER), Classes.class_details (VARCHAR(255)), ) CREATE TABLE Detention ( Detention.detention_id (INTEGER), Detention.detention_type_code (CHAR(10)), Detention.student_id (INTEGER), Detention.datetime_detention_start (DATETIME(3)), Detention.datetime_detention_end (DATETIME(3)), Detention.detention_summary (VARCHAR(255)), Detention.other_details (VARCHAR(255)), ) CREATE TABLE Ref_Achievement_Type ( Ref_Achievement_Type.achievement_type_code (CHAR(15)), Ref_Achievement_Type.achievement_type_description (VARCHAR(80)), ) CREATE TABLE Ref_Address_Types ( Ref_Address_Types.address_type_code (CHAR(10)), Ref_Address_Types.address_type_description (VARCHAR(255)), ) CREATE TABLE Ref_Detention_Type ( Ref_Detention_Type.detention_type_code (CHAR(10)), Ref_Detention_Type.detention_type_description (VARCHAR(80)), ) CREATE TABLE Ref_Event_Types ( Ref_Event_Types.event_type_code (CHAR(10)), Ref_Event_Types.event_type_description (VARCHAR(255)), ) CREATE TABLE Student_Events ( Student_Events.event_id (INTEGER), Student_Events.event_type_code (CHAR(10)), Student_Events.student_id (INTEGER), Student_Events.event_date (DATETIME(3)), Student_Events.other_details (VARCHAR(255)), ) CREATE TABLE Student_Loans ( Student_Loans.student_loan_id (INTEGER), Student_Loans.student_id (INTEGER), Student_Loans.date_of_loan (DATETIME(3)), Student_Loans.amount_of_loan (DECIMAL(15,4)), Student_Loans.other_details (VARCHAR(255)), ) CREATE TABLE Students ( Students.student_id (INTEGER), Students.bio_data (VARCHAR(255)), Students.student_details (VARCHAR(255)), ) CREATE TABLE Students_Addresses ( Students_Addresses.student_address_id (INTEGER), Students_Addresses.address_id (INTEGER), Students_Addresses.address_type_code (CHAR(10)), Students_Addresses.student_id (INTEGER), Students_Addresses.date_from (DATETIME(3)), Students_Addresses.date_to (DATETIME(3)), ) CREATE TABLE Teachers ( Teachers.teacher_id (INTEGER), Teachers.teacher_details (VARCHAR(255)), ) CREATE TABLE Transcripts ( Transcripts.transcript_id (INTEGER), Transcripts.student_id (INTEGER), Transcripts.date_of_transcript (DATETIME(3)), Transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code Achievements.student_id = Students.student_id Behaviour_Monitoring.student_id = Students.student_id Classes.student_id = Students.student_id Classes.teacher_id = Teachers.teacher_id Detention.detention_type_code = Ref_Detention_Type.detention_type_code Detention.student_id = Students.student_id Student_Events.event_type_code = Ref_Event_Types.event_type_code Student_Events.student_id = Students.student_id Student_Loans.student_id = Students.student_id Students_Addresses.address_id = Addresses.address_id Students_Addresses.address_type_code = Ref_Address_Types.address_type_code Students_Addresses.student_id = Students.student_id Transcripts.student_id = Students.student_id
Table Achievements ( Achievements.achievement_id (INTEGER), Achievements.achievement_type_code (CHAR(15)), Achievements.student_id (INTEGER), Achievements.date_achievement (DATETIME(3)), Achievements.achievement_details (VARCHAR(255)), Achievements.other_details (VARCHAR(255)), ) Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Behaviour_Monitoring ( Behaviour_Monitoring.behaviour_monitoring_id (INTEGER), Behaviour_Monitoring.student_id (INTEGER), Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)), ) Table Classes ( Classes.class_id (INTEGER), Classes.student_id (INTEGER), Classes.teacher_id (INTEGER), Classes.class_details (VARCHAR(255)), ) Table Detention ( Detention.detention_id (INTEGER), Detention.detention_type_code (CHAR(10)), Detention.student_id (INTEGER), Detention.datetime_detention_start (DATETIME(3)), Detention.datetime_detention_end (DATETIME(3)), Detention.detention_summary (VARCHAR(255)), Detention.other_details (VARCHAR(255)), ) Table Ref_Achievement_Type ( Ref_Achievement_Type.achievement_type_code (CHAR(15)), Ref_Achievement_Type.achievement_type_description (VARCHAR(80)), ) Table Ref_Address_Types ( Ref_Address_Types.address_type_code (CHAR(10)), Ref_Address_Types.address_type_description (VARCHAR(255)), ) Table Ref_Detention_Type ( Ref_Detention_Type.detention_type_code (CHAR(10)), Ref_Detention_Type.detention_type_description (VARCHAR(80)), ) Table Ref_Event_Types ( Ref_Event_Types.event_type_code (CHAR(10)), Ref_Event_Types.event_type_description (VARCHAR(255)), ) Table Student_Events ( Student_Events.event_id (INTEGER), Student_Events.event_type_code (CHAR(10)), Student_Events.student_id (INTEGER), Student_Events.event_date (DATETIME(3)), Student_Events.other_details (VARCHAR(255)), ) Table Student_Loans ( Student_Loans.student_loan_id (INTEGER), Student_Loans.student_id (INTEGER), Student_Loans.date_of_loan (DATETIME(3)), Student_Loans.amount_of_loan (DECIMAL(15,4)), Student_Loans.other_details (VARCHAR(255)), ) Table Students ( Students.student_id (INTEGER), Students.bio_data (VARCHAR(255)), Students.student_details (VARCHAR(255)), ) Table Students_Addresses ( Students_Addresses.student_address_id (INTEGER), Students_Addresses.address_id (INTEGER), Students_Addresses.address_type_code (CHAR(10)), Students_Addresses.student_id (INTEGER), Students_Addresses.date_from (DATETIME(3)), Students_Addresses.date_to (DATETIME(3)), ) Table Teachers ( Teachers.teacher_id (INTEGER), Teachers.teacher_details (VARCHAR(255)), ) Table Transcripts ( Transcripts.transcript_id (INTEGER), Transcripts.student_id (INTEGER), Transcripts.date_of_transcript (DATETIME(3)), Transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code Achievements.student_id = Students.student_id Behaviour_Monitoring.student_id = Students.student_id Classes.student_id = Students.student_id Classes.teacher_id = Teachers.teacher_id Detention.detention_type_code = Ref_Detention_Type.detention_type_code Detention.student_id = Students.student_id Student_Events.event_type_code = Ref_Event_Types.event_type_code Student_Events.student_id = Students.student_id Student_Loans.student_id = Students.student_id Students_Addresses.address_id = Addresses.address_id Students_Addresses.address_type_code = Ref_Address_Types.address_type_code Students_Addresses.student_id = Students.student_id Transcripts.student_id = Students.student_id
CREATE TABLE Achievements ( Achievements.achievement_id (INTEGER), Achievements.achievement_type_code (CHAR(15)), Achievements.student_id (INTEGER), Achievements.date_achievement (DATETIME(3)), Achievements.achievement_details (VARCHAR(255)), Achievements.other_details (VARCHAR(255)), ) CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Behaviour_Monitoring ( Behaviour_Monitoring.behaviour_monitoring_id (INTEGER), Behaviour_Monitoring.student_id (INTEGER), Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)), ) CREATE TABLE Classes ( Classes.class_id (INTEGER), Classes.student_id (INTEGER), Classes.teacher_id (INTEGER), Classes.class_details (VARCHAR(255)), ) CREATE TABLE Detention ( Detention.detention_id (INTEGER), Detention.detention_type_code (CHAR(10)), Detention.student_id (INTEGER), Detention.datetime_detention_start (DATETIME(3)), Detention.datetime_detention_end (DATETIME(3)), Detention.detention_summary (VARCHAR(255)), Detention.other_details (VARCHAR(255)), ) CREATE TABLE Ref_Achievement_Type ( Ref_Achievement_Type.achievement_type_code (CHAR(15)), Ref_Achievement_Type.achievement_type_description (VARCHAR(80)), ) CREATE TABLE Ref_Address_Types ( Ref_Address_Types.address_type_code (CHAR(10)), Ref_Address_Types.address_type_description (VARCHAR(255)), ) CREATE TABLE Ref_Detention_Type ( Ref_Detention_Type.detention_type_code (CHAR(10)), Ref_Detention_Type.detention_type_description (VARCHAR(80)), ) CREATE TABLE Ref_Event_Types ( Ref_Event_Types.event_type_code (CHAR(10)), Ref_Event_Types.event_type_description (VARCHAR(255)), ) CREATE TABLE Student_Events ( Student_Events.event_id (INTEGER), Student_Events.event_type_code (CHAR(10)), Student_Events.student_id (INTEGER), Student_Events.event_date (DATETIME(3)), Student_Events.other_details (VARCHAR(255)), ) CREATE TABLE Student_Loans ( Student_Loans.student_loan_id (INTEGER), Student_Loans.student_id (INTEGER), Student_Loans.date_of_loan (DATETIME(3)), Student_Loans.amount_of_loan (DECIMAL(15,4)), Student_Loans.other_details (VARCHAR(255)), ) CREATE TABLE Students ( Students.student_id (INTEGER), Students.bio_data (VARCHAR(255)), Students.student_details (VARCHAR(255)), ) CREATE TABLE Students_Addresses ( Students_Addresses.student_address_id (INTEGER), Students_Addresses.address_id (INTEGER), Students_Addresses.address_type_code (CHAR(10)), Students_Addresses.student_id (INTEGER), Students_Addresses.date_from (DATETIME(3)), Students_Addresses.date_to (DATETIME(3)), ) CREATE TABLE Teachers ( Teachers.teacher_id (INTEGER), Teachers.teacher_details (VARCHAR(255)), ) CREATE TABLE Transcripts ( Transcripts.transcript_id (INTEGER), Transcripts.student_id (INTEGER), Transcripts.date_of_transcript (DATETIME(3)), Transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code Achievements.student_id = Students.student_id Behaviour_Monitoring.student_id = Students.student_id Classes.student_id = Students.student_id Classes.teacher_id = Teachers.teacher_id Detention.detention_type_code = Ref_Detention_Type.detention_type_code Detention.student_id = Students.student_id Student_Events.event_type_code = Ref_Event_Types.event_type_code Student_Events.student_id = Students.student_id Student_Loans.student_id = Students.student_id Students_Addresses.address_id = Addresses.address_id Students_Addresses.address_type_code = Ref_Address_Types.address_type_code Students_Addresses.student_id = Students.student_id Transcripts.student_id = Students.student_id
Table achievements ( achievements.achievement_id (INTEGER), achievements.achievement_type_code (CHAR(15)), achievements.student_id (INTEGER), achievements.date_achievement (DATETIME(3)), achievements.achievement_details (VARCHAR(255)), achievements.other_details (VARCHAR(255)), ) Table addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) Table behaviour_monitoring ( behaviour_monitoring.behaviour_monitoring_id (INTEGER), behaviour_monitoring.student_id (INTEGER), behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)), ) Table classes ( classes.class_id (INTEGER), classes.student_id (INTEGER), classes.teacher_id (INTEGER), classes.class_details (VARCHAR(255)), ) Table detention ( detention.detention_id (INTEGER), detention.detention_type_code (CHAR(10)), detention.student_id (INTEGER), detention.datetime_detention_start (DATETIME(3)), detention.datetime_detention_end (DATETIME(3)), detention.detention_summary (VARCHAR(255)), detention.other_details (VARCHAR(255)), ) Table ref_achievement_type ( ref_achievement_type.achievement_type_code (CHAR(15)), ref_achievement_type.achievement_type_description (VARCHAR(80)), ) Table ref_address_types ( ref_address_types.address_type_code (CHAR(10)), ref_address_types.address_type_description (VARCHAR(255)), ) Table ref_detention_type ( ref_detention_type.detention_type_code (CHAR(10)), ref_detention_type.detention_type_description (VARCHAR(80)), ) Table ref_event_types ( ref_event_types.event_type_code (CHAR(10)), ref_event_types.event_type_description (VARCHAR(255)), ) Table student_events ( student_events.event_id (INTEGER), student_events.event_type_code (CHAR(10)), student_events.student_id (INTEGER), student_events.event_date (DATETIME(3)), student_events.other_details (VARCHAR(255)), ) Table student_loans ( student_loans.student_loan_id (INTEGER), student_loans.student_id (INTEGER), student_loans.date_of_loan (DATETIME(3)), student_loans.amount_of_loan (DECIMAL(15,4)), student_loans.other_details (VARCHAR(255)), ) Table students ( students.student_id (INTEGER), students.bio_data (VARCHAR(255)), students.student_details (VARCHAR(255)), ) Table students_addresses ( students_addresses.student_address_id (INTEGER), students_addresses.address_id (INTEGER), students_addresses.address_type_code (CHAR(10)), students_addresses.student_id (INTEGER), students_addresses.date_from (DATETIME(3)), students_addresses.date_to (DATETIME(3)), ) Table teachers ( teachers.teacher_id (INTEGER), teachers.teacher_details (VARCHAR(255)), ) Table transcripts ( transcripts.transcript_id (INTEGER), transcripts.student_id (INTEGER), transcripts.date_of_transcript (DATETIME(3)), transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: achievements.achievement_type_code = ref_achievement_type.achievement_type_code achievements.student_id = students.student_id behaviour_monitoring.student_id = students.student_id classes.student_id = students.student_id classes.teacher_id = teachers.teacher_id detention.detention_type_code = ref_detention_type.detention_type_code detention.student_id = students.student_id student_events.event_type_code = ref_event_types.event_type_code student_events.student_id = students.student_id student_loans.student_id = students.student_id students_addresses.address_id = addresses.address_id students_addresses.address_type_code = ref_address_types.address_type_code students_addresses.student_id = students.student_id transcripts.student_id = students.student_id
CREATE TABLE achievements ( achievements.achievement_id (INTEGER), achievements.achievement_type_code (CHAR(15)), achievements.student_id (INTEGER), achievements.date_achievement (DATETIME(3)), achievements.achievement_details (VARCHAR(255)), achievements.other_details (VARCHAR(255)), ) CREATE TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) CREATE TABLE behaviour_monitoring ( behaviour_monitoring.behaviour_monitoring_id (INTEGER), behaviour_monitoring.student_id (INTEGER), behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)), ) CREATE TABLE classes ( classes.class_id (INTEGER), classes.student_id (INTEGER), classes.teacher_id (INTEGER), classes.class_details (VARCHAR(255)), ) CREATE TABLE detention ( detention.detention_id (INTEGER), detention.detention_type_code (CHAR(10)), detention.student_id (INTEGER), detention.datetime_detention_start (DATETIME(3)), detention.datetime_detention_end (DATETIME(3)), detention.detention_summary (VARCHAR(255)), detention.other_details (VARCHAR(255)), ) CREATE TABLE ref_achievement_type ( ref_achievement_type.achievement_type_code (CHAR(15)), ref_achievement_type.achievement_type_description (VARCHAR(80)), ) CREATE TABLE ref_address_types ( ref_address_types.address_type_code (CHAR(10)), ref_address_types.address_type_description (VARCHAR(255)), ) CREATE TABLE ref_detention_type ( ref_detention_type.detention_type_code (CHAR(10)), ref_detention_type.detention_type_description (VARCHAR(80)), ) CREATE TABLE ref_event_types ( ref_event_types.event_type_code (CHAR(10)), ref_event_types.event_type_description (VARCHAR(255)), ) CREATE TABLE student_events ( student_events.event_id (INTEGER), student_events.event_type_code (CHAR(10)), student_events.student_id (INTEGER), student_events.event_date (DATETIME(3)), student_events.other_details (VARCHAR(255)), ) CREATE TABLE student_loans ( student_loans.student_loan_id (INTEGER), student_loans.student_id (INTEGER), student_loans.date_of_loan (DATETIME(3)), student_loans.amount_of_loan (DECIMAL(15,4)), student_loans.other_details (VARCHAR(255)), ) CREATE TABLE students ( students.student_id (INTEGER), students.bio_data (VARCHAR(255)), students.student_details (VARCHAR(255)), ) CREATE TABLE students_addresses ( students_addresses.student_address_id (INTEGER), students_addresses.address_id (INTEGER), students_addresses.address_type_code (CHAR(10)), students_addresses.student_id (INTEGER), students_addresses.date_from (DATETIME(3)), students_addresses.date_to (DATETIME(3)), ) CREATE TABLE teachers ( teachers.teacher_id (INTEGER), teachers.teacher_details (VARCHAR(255)), ) CREATE TABLE transcripts ( transcripts.transcript_id (INTEGER), transcripts.student_id (INTEGER), transcripts.date_of_transcript (DATETIME(3)), transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: achievements.achievement_type_code = ref_achievement_type.achievement_type_code achievements.student_id = students.student_id behaviour_monitoring.student_id = students.student_id classes.student_id = students.student_id classes.teacher_id = teachers.teacher_id detention.detention_type_code = ref_detention_type.detention_type_code detention.student_id = students.student_id student_events.event_type_code = ref_event_types.event_type_code student_events.student_id = students.student_id student_loans.student_id = students.student_id students_addresses.address_id = addresses.address_id students_addresses.address_type_code = ref_address_types.address_type_code students_addresses.student_id = students.student_id transcripts.student_id = students.student_id
{ 'Students': ['student_id', 'bio_data', 'student_details'], 'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript', 'transcript_details'], 'Behaviour_Monitoring': ['behaviour_monitoring_id', 'student_id', 'behaviour_monitoring_details'], 'Addresses': ['address_id', 'address_details'], 'Ref_Event_Types': ['event_type_code', 'event_type_description'], 'Ref_Achievement_Type': ['achievement_type_code', 'achievement_type_description'], 'Ref_Address_Types': ['address_type_code', 'address_type_description'], 'Ref_Detention_Type': ['detention_type_code', 'detention_type_description'], 'Student_Events': ['event_id', 'event_type_code', 'student_id', 'event_date', 'other_details'], 'Teachers': ['teacher_id', 'teacher_details'], 'Student_Loans': ['student_loan_id', 'student_id', 'date_of_loan', 'amount_of_loan', 'other_details'], 'Classes': ['class_id', 'student_id', 'teacher_id', 'class_details'], 'Students_Addresses': ['student_address_id', 'address_id', 'address_type_code', 'student_id', 'date_from', 'date_to'], 'Detention': ['detention_id', 'detention_type_code', 'student_id', 'datetime_detention_start', 'datetime_detention_end', 'detention_summary', 'other_details'], 'Achievements': ['achievement_id', 'achievement_type_code', 'student_id', 'date_achievement', 'achievement_details', 'other_details'] }
{ 'Teachers': ['teacher_id', 'teacher_details'], 'Classes': ['class_id', 'student_id', 'teacher_id'], 'Students': ['student_id', 'student_details'] }
TABLE Achievements ( Achievements.achievement_id (INTEGER), Achievements.achievement_type_code (CHAR(15)), Achievements.student_id (INTEGER), Achievements.date_achievement (DATETIME(3)), Achievements.achievement_details (VARCHAR(255)), Achievements.other_details (VARCHAR(255)), ) TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Behaviour_Monitoring ( Behaviour_Monitoring.behaviour_monitoring_id (INTEGER), Behaviour_Monitoring.student_id (INTEGER), Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)), ) TABLE Classes ( Classes.class_id (INTEGER), Classes.student_id (INTEGER), Classes.teacher_id (INTEGER), Classes.class_details (VARCHAR(255)), ) TABLE Detention ( Detention.detention_id (INTEGER), Detention.detention_type_code (CHAR(10)), Detention.student_id (INTEGER), Detention.datetime_detention_start (DATETIME(3)), Detention.datetime_detention_end (DATETIME(3)), Detention.detention_summary (VARCHAR(255)), Detention.other_details (VARCHAR(255)), ) TABLE Ref_Achievement_Type ( Ref_Achievement_Type.achievement_type_code (CHAR(15)), Ref_Achievement_Type.achievement_type_description (VARCHAR(80)), ) TABLE Ref_Address_Types ( Ref_Address_Types.address_type_code (CHAR(10)), Ref_Address_Types.address_type_description (VARCHAR(255)), ) TABLE Ref_Detention_Type ( Ref_Detention_Type.detention_type_code (CHAR(10)), Ref_Detention_Type.detention_type_description (VARCHAR(80)), ) TABLE Ref_Event_Types ( Ref_Event_Types.event_type_code (CHAR(10)), Ref_Event_Types.event_type_description (VARCHAR(255)), ) TABLE Student_Events ( Student_Events.event_id (INTEGER), Student_Events.event_type_code (CHAR(10)), Student_Events.student_id (INTEGER), Student_Events.event_date (DATETIME(3)), Student_Events.other_details (VARCHAR(255)), ) TABLE Student_Loans ( Student_Loans.student_loan_id (INTEGER), Student_Loans.student_id (INTEGER), Student_Loans.date_of_loan (DATETIME(3)), Student_Loans.amount_of_loan (DECIMAL(15,4)), Student_Loans.other_details (VARCHAR(255)), ) TABLE Students ( Students.student_id (INTEGER), Students.bio_data (VARCHAR(255)), Students.student_details (VARCHAR(255)), ) TABLE Students_Addresses ( Students_Addresses.student_address_id (INTEGER), Students_Addresses.address_id (INTEGER), Students_Addresses.address_type_code (CHAR(10)), Students_Addresses.student_id (INTEGER), Students_Addresses.date_from (DATETIME(3)), Students_Addresses.date_to (DATETIME(3)), ) TABLE Teachers ( Teachers.teacher_id (INTEGER), Teachers.teacher_details (VARCHAR(255)), ) TABLE Transcripts ( Transcripts.transcript_id (INTEGER), Transcripts.student_id (INTEGER), Transcripts.date_of_transcript (DATETIME(3)), Transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code Achievements.student_id = Students.student_id Behaviour_Monitoring.student_id = Students.student_id Classes.student_id = Students.student_id Classes.teacher_id = Teachers.teacher_id Detention.detention_type_code = Ref_Detention_Type.detention_type_code Detention.student_id = Students.student_id Student_Events.event_type_code = Ref_Event_Types.event_type_code Student_Events.student_id = Students.student_id Student_Loans.student_id = Students.student_id Students_Addresses.address_id = Addresses.address_id Students_Addresses.address_type_code = Ref_Address_Types.address_type_code Students_Addresses.student_id = Students.student_id Transcripts.student_id = Students.student_id
TABLE Achievements ( Achievements.achievement_id (INTEGER), Achievements.achievement_type_code (CHAR(15)), Achievements.student_id (INTEGER), Achievements.date_achievement (DATETIME(3)), Achievements.achievement_details (VARCHAR(255)), Achievements.other_details (VARCHAR(255)), ) TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Behaviour_Monitoring ( Behaviour_Monitoring.behaviour_monitoring_id (INTEGER), Behaviour_Monitoring.student_id (INTEGER), Behaviour_Monitoring.behaviour_monitoring_details (VARCHAR(255)), ) TABLE Classes ( Classes.class_id (INTEGER), Classes.student_id (INTEGER), Classes.teacher_id (INTEGER), Classes.class_details (VARCHAR(255)), ) TABLE Detention ( Detention.detention_id (INTEGER), Detention.detention_type_code (CHAR(10)), Detention.student_id (INTEGER), Detention.datetime_detention_start (DATETIME(3)), Detention.datetime_detention_end (DATETIME(3)), Detention.detention_summary (VARCHAR(255)), Detention.other_details (VARCHAR(255)), ) TABLE Ref_Achievement_Type ( Ref_Achievement_Type.achievement_type_code (CHAR(15)), Ref_Achievement_Type.achievement_type_description (VARCHAR(80)), ) TABLE Ref_Address_Types ( Ref_Address_Types.address_type_code (CHAR(10)), Ref_Address_Types.address_type_description (VARCHAR(255)), ) TABLE Ref_Detention_Type ( Ref_Detention_Type.detention_type_code (CHAR(10)), Ref_Detention_Type.detention_type_description (VARCHAR(80)), ) TABLE Ref_Event_Types ( Ref_Event_Types.event_type_code (CHAR(10)), Ref_Event_Types.event_type_description (VARCHAR(255)), ) TABLE Student_Events ( Student_Events.event_id (INTEGER), Student_Events.event_type_code (CHAR(10)), Student_Events.student_id (INTEGER), Student_Events.event_date (DATETIME(3)), Student_Events.other_details (VARCHAR(255)), ) TABLE Student_Loans ( Student_Loans.student_loan_id (INTEGER), Student_Loans.student_id (INTEGER), Student_Loans.date_of_loan (DATETIME(3)), Student_Loans.amount_of_loan (DECIMAL(15,4)), Student_Loans.other_details (VARCHAR(255)), ) TABLE Students ( Students.student_id (INTEGER), Students.bio_data (VARCHAR(255)), Students.student_details (VARCHAR(255)), ) TABLE Students_Addresses ( Students_Addresses.student_address_id (INTEGER), Students_Addresses.address_id (INTEGER), Students_Addresses.address_type_code (CHAR(10)), Students_Addresses.student_id (INTEGER), Students_Addresses.date_from (DATETIME(3)), Students_Addresses.date_to (DATETIME(3)), ) TABLE Teachers ( Teachers.teacher_id (INTEGER), Teachers.teacher_details (VARCHAR(255)), ) TABLE Transcripts ( Transcripts.transcript_id (INTEGER), Transcripts.student_id (INTEGER), Transcripts.date_of_transcript (DATETIME(3)), Transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: Achievements.achievement_type_code = Ref_Achievement_Type.achievement_type_code Achievements.student_id = Students.student_id Behaviour_Monitoring.student_id = Students.student_id Classes.student_id = Students.student_id Classes.teacher_id = Teachers.teacher_id Detention.detention_type_code = Ref_Detention_Type.detention_type_code Detention.student_id = Students.student_id Student_Events.event_type_code = Ref_Event_Types.event_type_code Student_Events.student_id = Students.student_id Student_Loans.student_id = Students.student_id Students_Addresses.address_id = Addresses.address_id Students_Addresses.address_type_code = Ref_Address_Types.address_type_code Students_Addresses.student_id = Students.student_id Transcripts.student_id = Students.student_id
TABLE achievements ( achievements.achievement_id (INTEGER), achievements.achievement_type_code (CHAR(15)), achievements.student_id (INTEGER), achievements.date_achievement (DATETIME(3)), achievements.achievement_details (VARCHAR(255)), achievements.other_details (VARCHAR(255)), ) TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) TABLE behaviour_monitoring ( behaviour_monitoring.behaviour_monitoring_id (INTEGER), behaviour_monitoring.student_id (INTEGER), behaviour_monitoring.behaviour_monitoring_details (VARCHAR(255)), ) TABLE classes ( classes.class_id (INTEGER), classes.student_id (INTEGER), classes.teacher_id (INTEGER), classes.class_details (VARCHAR(255)), ) TABLE detention ( detention.detention_id (INTEGER), detention.detention_type_code (CHAR(10)), detention.student_id (INTEGER), detention.datetime_detention_start (DATETIME(3)), detention.datetime_detention_end (DATETIME(3)), detention.detention_summary (VARCHAR(255)), detention.other_details (VARCHAR(255)), ) TABLE ref_achievement_type ( ref_achievement_type.achievement_type_code (CHAR(15)), ref_achievement_type.achievement_type_description (VARCHAR(80)), ) TABLE ref_address_types ( ref_address_types.address_type_code (CHAR(10)), ref_address_types.address_type_description (VARCHAR(255)), ) TABLE ref_detention_type ( ref_detention_type.detention_type_code (CHAR(10)), ref_detention_type.detention_type_description (VARCHAR(80)), ) TABLE ref_event_types ( ref_event_types.event_type_code (CHAR(10)), ref_event_types.event_type_description (VARCHAR(255)), ) TABLE student_events ( student_events.event_id (INTEGER), student_events.event_type_code (CHAR(10)), student_events.student_id (INTEGER), student_events.event_date (DATETIME(3)), student_events.other_details (VARCHAR(255)), ) TABLE student_loans ( student_loans.student_loan_id (INTEGER), student_loans.student_id (INTEGER), student_loans.date_of_loan (DATETIME(3)), student_loans.amount_of_loan (DECIMAL(15,4)), student_loans.other_details (VARCHAR(255)), ) TABLE students ( students.student_id (INTEGER), students.bio_data (VARCHAR(255)), students.student_details (VARCHAR(255)), ) TABLE students_addresses ( students_addresses.student_address_id (INTEGER), students_addresses.address_id (INTEGER), students_addresses.address_type_code (CHAR(10)), students_addresses.student_id (INTEGER), students_addresses.date_from (DATETIME(3)), students_addresses.date_to (DATETIME(3)), ) TABLE teachers ( teachers.teacher_id (INTEGER), teachers.teacher_details (VARCHAR(255)), ) TABLE transcripts ( transcripts.transcript_id (INTEGER), transcripts.student_id (INTEGER), transcripts.date_of_transcript (DATETIME(3)), transcripts.transcript_details (VARCHAR(255)), ) Possible JOINs: achievements.achievement_type_code = ref_achievement_type.achievement_type_code achievements.student_id = students.student_id behaviour_monitoring.student_id = students.student_id classes.student_id = students.student_id classes.teacher_id = teachers.teacher_id detention.detention_type_code = ref_detention_type.detention_type_code detention.student_id = students.student_id student_events.event_type_code = ref_event_types.event_type_code student_events.student_id = students.student_id student_loans.student_id = students.student_id students_addresses.address_id = addresses.address_id students_addresses.address_type_code = ref_address_types.address_type_code students_addresses.student_id = students.student_id transcripts.student_id = students.student_id
university_rank
CREATE TABLE major ( "Major_ID" INTEGER, "Major_Name" TEXT, "Major_Code" INTEGER, PRIMARY KEY ("Major_ID") ) CREATE TABLE major_ranking ( "Rank" INTEGER, "University_ID" INTEGER, "Major_ID" INTEGER, PRIMARY KEY ("Rank", "Major_ID", "University_ID"), FOREIGN KEY("Major_ID") REFERENCES major ("Major_ID"), FOREIGN KEY("University_ID") REFERENCES university ("University_ID") ) CREATE TABLE overall_ranking ( "Rank" INTEGER, "University_ID" INTEGER, "Reputation_point" INTEGER, "Research_point" INTEGER, "Citation_point" INTEGER, "Total" INTEGER, PRIMARY KEY ("University_ID"), FOREIGN KEY("University_ID") REFERENCES university ("University_ID") ) CREATE TABLE university ( "University_ID" INTEGER, "University_Name" TEXT, "City" TEXT, "State" TEXT, "Team_Name" TEXT, "Affiliation" TEXT, "Enrollment" INTEGER, "Home_Conference" TEXT, PRIMARY KEY ("University_ID") )
which states do have more than two universities with enrollment smaller than 3000?
medium
Table major ( major.Major_ID (INT), major.Major_Name (TEXT), major.Major_Code (INT), ) Table major_ranking ( major_ranking.Rank (INT), major_ranking.University_ID (INT), major_ranking.Major_ID (INT), ) Table overall_ranking ( overall_ranking.Rank (INT), overall_ranking.University_ID (INT), overall_ranking.Reputation_point (INT), overall_ranking.Research_point (INT), overall_ranking.Citation_point (INT), overall_ranking.Total (INT), ) Table university ( university.University_ID (INT), university.University_Name (TEXT), university.City (TEXT), university.State (TEXT), university.Team_Name (TEXT), university.Affiliation (TEXT), university.Enrollment (INT), university.Home_Conference (TEXT), ) Possible JOINs: major_ranking.University_ID = university.University_ID major_ranking.Major_ID = major.Major_ID overall_ranking.University_ID = university.University_ID
SELECT state FROM university WHERE enrollment < 3000 GROUP BY state HAVING count(*) > 2
{ 'university': ['university_id', 'state', 'enrollment'] }
CREATE TABLE major ( major.Major_ID (INT), major.Major_Name (TEXT), major.Major_Code (INT), ) CREATE TABLE major_ranking ( major_ranking.Rank (INT), major_ranking.University_ID (INT), major_ranking.Major_ID (INT), ) CREATE TABLE overall_ranking ( overall_ranking.Rank (INT), overall_ranking.University_ID (INT), overall_ranking.Reputation_point (INT), overall_ranking.Research_point (INT), overall_ranking.Citation_point (INT), overall_ranking.Total (INT), ) CREATE TABLE university ( university.University_ID (INT), university.University_Name (TEXT), university.City (TEXT), university.State (TEXT), university.Team_Name (TEXT), university.Affiliation (TEXT), university.Enrollment (INT), university.Home_Conference (TEXT), ) Possible JOINs: major_ranking.University_ID = university.University_ID major_ranking.Major_ID = major.Major_ID overall_ranking.University_ID = university.University_ID
Table major ( major.major_id (INT), major.major_name (TEXT), major.major_code (INT), ) Table major_ranking ( major_ranking.rank (INT), major_ranking.university_id (INT), major_ranking.major_id (INT), ) Table overall_ranking ( overall_ranking.rank (INT), overall_ranking.university_id (INT), overall_ranking.reputation_point (INT), overall_ranking.research_point (INT), overall_ranking.citation_point (INT), overall_ranking.total (INT), ) Table university ( university.university_id (INT), university.university_name (TEXT), university.city (TEXT), university.state (TEXT), university.team_name (TEXT), university.affiliation (TEXT), university.enrollment (INT), university.home_conference (TEXT), ) Possible JOINs: major_ranking.university_id = university.university_id major_ranking.major_id = major.major_id overall_ranking.university_id = university.university_id
CREATE TABLE major ( major.major_id (INT), major.major_name (TEXT), major.major_code (INT), ) CREATE TABLE major_ranking ( major_ranking.rank (INT), major_ranking.university_id (INT), major_ranking.major_id (INT), ) CREATE TABLE overall_ranking ( overall_ranking.rank (INT), overall_ranking.university_id (INT), overall_ranking.reputation_point (INT), overall_ranking.research_point (INT), overall_ranking.citation_point (INT), overall_ranking.total (INT), ) CREATE TABLE university ( university.university_id (INT), university.university_name (TEXT), university.city (TEXT), university.state (TEXT), university.team_name (TEXT), university.affiliation (TEXT), university.enrollment (INT), university.home_conference (TEXT), ) Possible JOINs: major_ranking.university_id = university.university_id major_ranking.major_id = major.major_id overall_ranking.university_id = university.university_id
Table major ( major.major_id (INT), major.major_name (TEXT), major.major_code (INT), ) Table major_ranking ( major_ranking.rank (INT), major_ranking.university_id (INT), major_ranking.major_id (INT), ) Table overall_ranking ( overall_ranking.rank (INT), overall_ranking.university_id (INT), overall_ranking.reputation_point (INT), overall_ranking.research_point (INT), overall_ranking.citation_point (INT), overall_ranking.total (INT), ) Table university ( university.university_id (INT), university.university_name (TEXT), university.city (TEXT), university.state (TEXT), university.team_name (TEXT), university.affiliation (TEXT), university.enrollment (INT), university.home_conference (TEXT), ) Possible JOINs: major_ranking.university_id = university.university_id major_ranking.major_id = major.major_id overall_ranking.university_id = university.university_id
CREATE TABLE major ( major.major_id (INT), major.major_name (TEXT), major.major_code (INT), ) CREATE TABLE major_ranking ( major_ranking.rank (INT), major_ranking.university_id (INT), major_ranking.major_id (INT), ) CREATE TABLE overall_ranking ( overall_ranking.rank (INT), overall_ranking.university_id (INT), overall_ranking.reputation_point (INT), overall_ranking.research_point (INT), overall_ranking.citation_point (INT), overall_ranking.total (INT), ) CREATE TABLE university ( university.university_id (INT), university.university_name (TEXT), university.city (TEXT), university.state (TEXT), university.team_name (TEXT), university.affiliation (TEXT), university.enrollment (INT), university.home_conference (TEXT), ) Possible JOINs: major_ranking.university_id = university.university_id major_ranking.major_id = major.major_id overall_ranking.university_id = university.university_id
{ 'university': ['University_ID', 'University_Name', 'City', 'State', 'Team_Name', 'Affiliation', 'Enrollment', 'Home_Conference'], 'overall_ranking': ['Rank', 'University_ID', 'Reputation_point', 'Research_point', 'Citation_point', 'Total'], 'major': ['Major_ID', 'Major_Name', 'Major_Code'], 'major_ranking': ['Rank', 'University_ID', 'Major_ID'] }
{ 'university': ['University_ID', 'State', 'Enrollment'] }
TABLE major ( major.Major_ID (INT), major.Major_Name (TEXT), major.Major_Code (INT), ) TABLE major_ranking ( major_ranking.Rank (INT), major_ranking.University_ID (INT), major_ranking.Major_ID (INT), ) TABLE overall_ranking ( overall_ranking.Rank (INT), overall_ranking.University_ID (INT), overall_ranking.Reputation_point (INT), overall_ranking.Research_point (INT), overall_ranking.Citation_point (INT), overall_ranking.Total (INT), ) TABLE university ( university.University_ID (INT), university.University_Name (TEXT), university.City (TEXT), university.State (TEXT), university.Team_Name (TEXT), university.Affiliation (TEXT), university.Enrollment (INT), university.Home_Conference (TEXT), ) Possible JOINs: major_ranking.University_ID = university.University_ID major_ranking.Major_ID = major.Major_ID overall_ranking.University_ID = university.University_ID
TABLE major ( major.major_id (INT), major.major_name (TEXT), major.major_code (INT), ) TABLE major_ranking ( major_ranking.rank (INT), major_ranking.university_id (INT), major_ranking.major_id (INT), ) TABLE overall_ranking ( overall_ranking.rank (INT), overall_ranking.university_id (INT), overall_ranking.reputation_point (INT), overall_ranking.research_point (INT), overall_ranking.citation_point (INT), overall_ranking.total (INT), ) TABLE university ( university.university_id (INT), university.university_name (TEXT), university.city (TEXT), university.state (TEXT), university.team_name (TEXT), university.affiliation (TEXT), university.enrollment (INT), university.home_conference (TEXT), ) Possible JOINs: major_ranking.university_id = university.university_id major_ranking.major_id = major.major_id overall_ranking.university_id = university.university_id
TABLE major ( major.major_id (INT), major.major_name (TEXT), major.major_code (INT), ) TABLE major_ranking ( major_ranking.rank (INT), major_ranking.university_id (INT), major_ranking.major_id (INT), ) TABLE overall_ranking ( overall_ranking.rank (INT), overall_ranking.university_id (INT), overall_ranking.reputation_point (INT), overall_ranking.research_point (INT), overall_ranking.citation_point (INT), overall_ranking.total (INT), ) TABLE university ( university.university_id (INT), university.university_name (TEXT), university.city (TEXT), university.state (TEXT), university.team_name (TEXT), university.affiliation (TEXT), university.enrollment (INT), university.home_conference (TEXT), ) Possible JOINs: major_ranking.university_id = university.university_id major_ranking.major_id = major.major_id overall_ranking.university_id = university.university_id
bakery_1
CREATE TABLE customers ( "Id" INTEGER, "LastName" TEXT, "FirstName" TEXT, PRIMARY KEY ("Id") ) CREATE TABLE goods ( "Id" TEXT, "Flavor" TEXT, "Food" TEXT, "Price" REAL, PRIMARY KEY ("Id") ) CREATE TABLE items ( "Receipt" INTEGER, "Ordinal" INTEGER, "Item" TEXT, PRIMARY KEY ("Receipt", "Ordinal"), FOREIGN KEY("Item") REFERENCES goods ("Id") ) CREATE TABLE receipts ( "ReceiptNumber" INTEGER, "Date" TEXT, "CustomerId" INTEGER, PRIMARY KEY ("ReceiptNumber"), FOREIGN KEY("CustomerId") REFERENCES customers ("Id") )
Find all the items that have chocolate flavor but were not bought more than 10 times.
hard
Table customers ( customers.Id (INTEGER), customers.LastName (TEXT), customers.FirstName (TEXT), ) Table goods ( goods.Id (TEXT), goods.Flavor (TEXT), goods.Food (TEXT), goods.Price (REAL), ) Table items ( items.Receipt (INTEGER), items.Ordinal (INTEGER), items.Item (TEXT), ) Table receipts ( receipts.ReceiptNumber (INTEGER), receipts.Date (TEXT), receipts.CustomerId (INTEGER), ) Possible JOINs: items.Item = goods.Id receipts.CustomerId = customers.Id
SELECT DISTINCT items.item FROM items JOIN goods ON items.item = goods.id WHERE goods.flavor = "Chocolate" GROUP BY item HAVING count(*) <= 10
{ 'items': ['receipt', 'item'], 'goods': ['id', 'flavor'] }
CREATE TABLE customers ( customers.Id (INTEGER), customers.LastName (TEXT), customers.FirstName (TEXT), ) CREATE TABLE goods ( goods.Id (TEXT), goods.Flavor (TEXT), goods.Food (TEXT), goods.Price (REAL), ) CREATE TABLE items ( items.Receipt (INTEGER), items.Ordinal (INTEGER), items.Item (TEXT), ) CREATE TABLE receipts ( receipts.ReceiptNumber (INTEGER), receipts.Date (TEXT), receipts.CustomerId (INTEGER), ) Possible JOINs: items.Item = goods.Id receipts.CustomerId = customers.Id
Table customers ( customers.id (INTEGER), customers.lastname (TEXT), customers.firstname (TEXT), ) Table goods ( goods.id (TEXT), goods.flavor (TEXT), goods.food (TEXT), goods.price (REAL), ) Table items ( items.receipt (INTEGER), items.ordinal (INTEGER), items.item (TEXT), ) Table receipts ( receipts.receiptnumber (INTEGER), receipts.date (TEXT), receipts.customerid (INTEGER), ) Possible JOINs: items.item = goods.id receipts.customerid = customers.id
CREATE TABLE customers ( customers.id (INTEGER), customers.lastname (TEXT), customers.firstname (TEXT), ) CREATE TABLE goods ( goods.id (TEXT), goods.flavor (TEXT), goods.food (TEXT), goods.price (REAL), ) CREATE TABLE items ( items.receipt (INTEGER), items.ordinal (INTEGER), items.item (TEXT), ) CREATE TABLE receipts ( receipts.receiptnumber (INTEGER), receipts.date (TEXT), receipts.customerid (INTEGER), ) Possible JOINs: items.item = goods.id receipts.customerid = customers.id
Table customers ( customers.id (INTEGER), customers.lastname (TEXT), customers.firstname (TEXT), ) Table goods ( goods.id (TEXT), goods.flavor (TEXT), goods.food (TEXT), goods.price (REAL), ) Table items ( items.receipt (INTEGER), items.ordinal (INTEGER), items.item (TEXT), ) Table receipts ( receipts.receiptnumber (INTEGER), receipts.date (TEXT), receipts.customerid (INTEGER), ) Possible JOINs: items.item = goods.id receipts.customerid = customers.id
CREATE TABLE customers ( customers.id (INTEGER), customers.lastname (TEXT), customers.firstname (TEXT), ) CREATE TABLE goods ( goods.id (TEXT), goods.flavor (TEXT), goods.food (TEXT), goods.price (REAL), ) CREATE TABLE items ( items.receipt (INTEGER), items.ordinal (INTEGER), items.item (TEXT), ) CREATE TABLE receipts ( receipts.receiptnumber (INTEGER), receipts.date (TEXT), receipts.customerid (INTEGER), ) Possible JOINs: items.item = goods.id receipts.customerid = customers.id
{ 'customers': ['Id', 'LastName', 'FirstName'], 'goods': ['Id', 'Flavor', 'Food', 'Price'], 'items': ['Receipt', 'Ordinal', 'Item'], 'receipts': ['ReceiptNumber', 'Date', 'CustomerId'] }
{ 'items': ['Receipt', 'Item'], 'goods': ['Id', 'Flavor'] }
TABLE customers ( customers.Id (INTEGER), customers.LastName (TEXT), customers.FirstName (TEXT), ) TABLE goods ( goods.Id (TEXT), goods.Flavor (TEXT), goods.Food (TEXT), goods.Price (REAL), ) TABLE items ( items.Receipt (INTEGER), items.Ordinal (INTEGER), items.Item (TEXT), ) TABLE receipts ( receipts.ReceiptNumber (INTEGER), receipts.Date (TEXT), receipts.CustomerId (INTEGER), ) Possible JOINs: items.Item = goods.Id receipts.CustomerId = customers.Id
TABLE customers ( customers.id (INTEGER), customers.lastname (TEXT), customers.firstname (TEXT), ) TABLE goods ( goods.id (TEXT), goods.flavor (TEXT), goods.food (TEXT), goods.price (REAL), ) TABLE items ( items.receipt (INTEGER), items.ordinal (INTEGER), items.item (TEXT), ) TABLE receipts ( receipts.receiptnumber (INTEGER), receipts.date (TEXT), receipts.customerid (INTEGER), ) Possible JOINs: items.item = goods.id receipts.customerid = customers.id
TABLE customers ( customers.id (INTEGER), customers.lastname (TEXT), customers.firstname (TEXT), ) TABLE goods ( goods.id (TEXT), goods.flavor (TEXT), goods.food (TEXT), goods.price (REAL), ) TABLE items ( items.receipt (INTEGER), items.ordinal (INTEGER), items.item (TEXT), ) TABLE receipts ( receipts.receiptnumber (INTEGER), receipts.date (TEXT), receipts.customerid (INTEGER), ) Possible JOINs: items.item = goods.id receipts.customerid = customers.id
car_racing
CREATE TABLE "country" ( "Country_Id" int, "Country" text, "Capital" text, "Official_native_language" text, "Regoin" text, PRIMARY KEY ("Country_Id") ) /* 0 rows from country table: Country_Id Country Capital Official_native_language Regoin */ CREATE TABLE `team` ( "Team_ID" int, "Team" text, "Make" text, "Manager" text, "Sponsor" text, "Car_Owner" text, PRIMARY KEY ("Team_ID") ) /* 0 rows from team table: Team_ID Team Make Manager Sponsor Car_Owner */ CREATE TABLE `driver` ( "Driver_ID" int, "Driver" text, "Country" int, "Age" int, "Car_#" real, "Make" text, "Points" text, "Laps" real, "Winnings" text, PRIMARY KEY ("Driver_ID"), FOREIGN KEY (`Country`) REFERENCES `country`(`Country_ID`) ) /* 0 rows from driver table: Driver_ID Driver Country Age Car_# Make Points Laps Winnings */ CREATE TABLE `team_driver` ( "Team_ID" int, "Driver_ID" int, PRIMARY KEY ("Team_ID","Driver_ID"), FOREIGN KEY (`Team_ID`) REFERENCES `team`(`Team_ID`), FOREIGN KEY (`Driver_ID`) REFERENCES `driver`(`Driver_ID`) ) /* 0 rows from team_driver table: Team_ID Driver_ID */
Find the highest and lowest points of drivers.
medium
Table country ( country.Country_Id (INT), country.Country (TEXT), country.Capital (TEXT), country.Official_native_language (TEXT), country.Regoin (TEXT), ) Table driver ( driver.Driver_ID (INT), driver.Driver (TEXT), driver.Country (INT), driver.Age (INT), driver.Car_# (REAL), driver.Make (TEXT), driver.Points (TEXT), driver.Laps (REAL), driver.Winnings (TEXT), ) Table team ( team.Team_ID (INT), team.Team (TEXT), team.Make (TEXT), team.Manager (TEXT), team.Sponsor (TEXT), team.Car_Owner (TEXT), ) Table team_driver ( team_driver.Team_ID (INT), team_driver.Driver_ID (INT), ) Possible JOINs: driver.Country = country.Country_ID team_driver.Team_ID = team.Team_ID team_driver.Driver_ID = driver.Driver_ID
SELECT max(Points) , min(Points) FROM driver
{ 'driver': ['driver_id', 'driver', 'points'] }
CREATE TABLE country ( country.Country_Id (INT), country.Country (TEXT), country.Capital (TEXT), country.Official_native_language (TEXT), country.Regoin (TEXT), ) CREATE TABLE driver ( driver.Driver_ID (INT), driver.Driver (TEXT), driver.Country (INT), driver.Age (INT), driver.Car_# (REAL), driver.Make (TEXT), driver.Points (TEXT), driver.Laps (REAL), driver.Winnings (TEXT), ) CREATE TABLE team ( team.Team_ID (INT), team.Team (TEXT), team.Make (TEXT), team.Manager (TEXT), team.Sponsor (TEXT), team.Car_Owner (TEXT), ) CREATE TABLE team_driver ( team_driver.Team_ID (INT), team_driver.Driver_ID (INT), ) Possible JOINs: driver.Country = country.Country_ID team_driver.Team_ID = team.Team_ID team_driver.Driver_ID = driver.Driver_ID
Table country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) Table driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) Table team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) Table team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
CREATE TABLE country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) CREATE TABLE driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) CREATE TABLE team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) CREATE TABLE team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
Table country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) Table driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) Table team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) Table team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
CREATE TABLE country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) CREATE TABLE driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) CREATE TABLE team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) CREATE TABLE team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
{ 'country': ['Country_Id', 'Country', 'Capital', 'Official_native_language', 'Regoin'], 'team': ['Team_ID', 'Team', 'Make', 'Manager', 'Sponsor', 'Car_Owner'], 'driver': ['Driver_ID', 'Driver', 'Country', 'Age', 'Car_#', 'Make', 'Points', 'Laps', 'Winnings'], 'team_driver': ['Team_ID', 'Driver_ID'] }
{ 'driver': ['Driver_ID', 'Driver', 'Points'] }
TABLE country ( country.Country_Id (INT), country.Country (TEXT), country.Capital (TEXT), country.Official_native_language (TEXT), country.Regoin (TEXT), ) TABLE driver ( driver.Driver_ID (INT), driver.Driver (TEXT), driver.Country (INT), driver.Age (INT), driver.Car_# (REAL), driver.Make (TEXT), driver.Points (TEXT), driver.Laps (REAL), driver.Winnings (TEXT), ) TABLE team ( team.Team_ID (INT), team.Team (TEXT), team.Make (TEXT), team.Manager (TEXT), team.Sponsor (TEXT), team.Car_Owner (TEXT), ) TABLE team_driver ( team_driver.Team_ID (INT), team_driver.Driver_ID (INT), ) Possible JOINs: driver.Country = country.Country_ID team_driver.Team_ID = team.Team_ID team_driver.Driver_ID = driver.Driver_ID
TABLE country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) TABLE driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) TABLE team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) TABLE team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
TABLE country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) TABLE driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) TABLE team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) TABLE team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
cre_Doc_Workflow
CREATE TABLE "Authors" ( author_name VARCHAR(255) NOT NULL, other_details VARCHAR(255) NOT NULL, PRIMARY KEY (author_name) ) CREATE TABLE "Business_Processes" ( process_id INTEGER NOT NULL, next_process_id INTEGER, process_name VARCHAR(255) NOT NULL, process_description VARCHAR(255) NOT NULL, other_details VARCHAR(255), PRIMARY KEY (process_id) ) CREATE TABLE "Documents" ( document_id INTEGER NOT NULL, author_name VARCHAR(255) NOT NULL, document_name VARCHAR(255) NOT NULL, document_description VARCHAR(255) NOT NULL, other_details VARCHAR(255), PRIMARY KEY (document_id), FOREIGN KEY(author_name) REFERENCES "Authors" (author_name) ) CREATE TABLE "Documents_Processes" ( document_id INTEGER NOT NULL, process_id INTEGER NOT NULL, process_outcome_code CHAR(15) NOT NULL, process_status_code CHAR(15) NOT NULL, PRIMARY KEY (document_id, process_id), FOREIGN KEY(document_id) REFERENCES "Documents" (document_id), FOREIGN KEY(process_id) REFERENCES "Business_Processes" (process_id), FOREIGN KEY(process_outcome_code) REFERENCES "Process_Outcomes" (process_outcome_code), FOREIGN KEY(process_status_code) REFERENCES "Process_Status" (process_status_code) ) CREATE TABLE "Process_Outcomes" ( process_outcome_code CHAR(15) NOT NULL, process_outcome_description VARCHAR(255) NOT NULL, PRIMARY KEY (process_outcome_code) ) CREATE TABLE "Process_Status" ( process_status_code CHAR(15) NOT NULL, process_status_description VARCHAR(255) NOT NULL, PRIMARY KEY (process_status_code) ) CREATE TABLE "Ref_Staff_Roles" ( staff_role_code CHAR(15) NOT NULL, staff_role_description VARCHAR(255) NOT NULL, PRIMARY KEY (staff_role_code) ) CREATE TABLE "Staff" ( staff_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_in_Processes" ( document_id INTEGER NOT NULL, process_id INTEGER NOT NULL, staff_id INTEGER NOT NULL, staff_role_code CHAR(15) NOT NULL, date_from DATETIME, date_to DATETIME, other_details VARCHAR(255), PRIMARY KEY (document_id, process_id, staff_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(document_id, process_id) REFERENCES "Documents_Processes" (document_id, process_id), FOREIGN KEY(staff_role_code) REFERENCES "Ref_Staff_Roles" (staff_role_code) )
What is the process name for the next process of the process with id 9?
hard
Table Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) Table Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) Table Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) Table Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) Table Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) Table Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) Table Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
SELECT process_name FROM Business_processes WHERE process_id = (SELECT next_process_id FROM Business_processes WHERE process_id = 9)
{ 'business_processes': ['process_id', 'next_process_id', 'process_name'] }
CREATE TABLE Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) CREATE TABLE Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) CREATE TABLE Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) CREATE TABLE Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) CREATE TABLE Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) CREATE TABLE Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) CREATE TABLE Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
Table Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) Table Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) Table Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) Table Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) Table Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) Table Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) Table Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
CREATE TABLE Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) CREATE TABLE Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) CREATE TABLE Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) CREATE TABLE Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) CREATE TABLE Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) CREATE TABLE Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) CREATE TABLE Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
Table authors ( authors.author_name (VARCHAR(255)), authors.other_details (VARCHAR(255)), ) Table business_processes ( business_processes.process_id (INTEGER), business_processes.next_process_id (INTEGER), business_processes.process_name (VARCHAR(255)), business_processes.process_description (VARCHAR(255)), business_processes.other_details (VARCHAR(255)), ) Table documents ( documents.document_id (INTEGER), documents.author_name (VARCHAR(255)), documents.document_name (VARCHAR(255)), documents.document_description (VARCHAR(255)), documents.other_details (VARCHAR(255)), ) Table documents_processes ( documents_processes.document_id (INTEGER), documents_processes.process_id (INTEGER), documents_processes.process_outcome_code (CHAR(15)), documents_processes.process_status_code (CHAR(15)), ) Table process_outcomes ( process_outcomes.process_outcome_code (CHAR(15)), process_outcomes.process_outcome_description (VARCHAR(255)), ) Table process_status ( process_status.process_status_code (CHAR(15)), process_status.process_status_description (VARCHAR(255)), ) Table ref_staff_roles ( ref_staff_roles.staff_role_code (CHAR(15)), ref_staff_roles.staff_role_description (VARCHAR(255)), ) Table staff ( staff.staff_id (INTEGER), staff.staff_details (VARCHAR(255)), ) Table staff_in_processes ( staff_in_processes.document_id (INTEGER), staff_in_processes.process_id (INTEGER), staff_in_processes.staff_id (INTEGER), staff_in_processes.staff_role_code (CHAR(15)), staff_in_processes.date_from (DATETIME), staff_in_processes.date_to (DATETIME), staff_in_processes.other_details (VARCHAR(255)), ) Possible JOINs: documents.author_name = authors.author_name documents_processes.document_id = documents.document_id documents_processes.process_id = business_processes.process_id documents_processes.process_outcome_code = process_outcomes.process_outcome_code documents_processes.process_status_code = process_status.process_status_code staff_in_processes.document_id = documents_processes.document_id staff_in_processes.process_id = documents_processes.process_id staff_in_processes.staff_id = staff.staff_id staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
CREATE TABLE authors ( authors.author_name (VARCHAR(255)), authors.other_details (VARCHAR(255)), ) CREATE TABLE business_processes ( business_processes.process_id (INTEGER), business_processes.next_process_id (INTEGER), business_processes.process_name (VARCHAR(255)), business_processes.process_description (VARCHAR(255)), business_processes.other_details (VARCHAR(255)), ) CREATE TABLE documents ( documents.document_id (INTEGER), documents.author_name (VARCHAR(255)), documents.document_name (VARCHAR(255)), documents.document_description (VARCHAR(255)), documents.other_details (VARCHAR(255)), ) CREATE TABLE documents_processes ( documents_processes.document_id (INTEGER), documents_processes.process_id (INTEGER), documents_processes.process_outcome_code (CHAR(15)), documents_processes.process_status_code (CHAR(15)), ) CREATE TABLE process_outcomes ( process_outcomes.process_outcome_code (CHAR(15)), process_outcomes.process_outcome_description (VARCHAR(255)), ) CREATE TABLE process_status ( process_status.process_status_code (CHAR(15)), process_status.process_status_description (VARCHAR(255)), ) CREATE TABLE ref_staff_roles ( ref_staff_roles.staff_role_code (CHAR(15)), ref_staff_roles.staff_role_description (VARCHAR(255)), ) CREATE TABLE staff ( staff.staff_id (INTEGER), staff.staff_details (VARCHAR(255)), ) CREATE TABLE staff_in_processes ( staff_in_processes.document_id (INTEGER), staff_in_processes.process_id (INTEGER), staff_in_processes.staff_id (INTEGER), staff_in_processes.staff_role_code (CHAR(15)), staff_in_processes.date_from (DATETIME), staff_in_processes.date_to (DATETIME), staff_in_processes.other_details (VARCHAR(255)), ) Possible JOINs: documents.author_name = authors.author_name documents_processes.document_id = documents.document_id documents_processes.process_id = business_processes.process_id documents_processes.process_outcome_code = process_outcomes.process_outcome_code documents_processes.process_status_code = process_status.process_status_code staff_in_processes.document_id = documents_processes.document_id staff_in_processes.process_id = documents_processes.process_id staff_in_processes.staff_id = staff.staff_id staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
{ 'Staff': ['staff_id', 'staff_details'], 'Ref_Staff_Roles': ['staff_role_code', 'staff_role_description'], 'Process_Outcomes': ['process_outcome_code', 'process_outcome_description'], 'Process_Status': ['process_status_code', 'process_status_description'], 'Authors': ['author_name', 'other_details'], 'Documents': ['document_id', 'author_name', 'document_name', 'document_description', 'other_details'], 'Business_Processes': ['process_id', 'next_process_id', 'process_name', 'process_description', 'other_details'], 'Documents_Processes': ['document_id', 'process_id', 'process_outcome_code', 'process_status_code'], 'Staff_in_Processes': ['document_id', 'process_id', 'staff_id', 'staff_role_code', 'date_from', 'date_to', 'other_details'] }
{ 'Business_Processes': ['process_id', 'next_process_id', 'process_name'] }
TABLE Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) TABLE Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) TABLE Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) TABLE Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) TABLE Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) TABLE Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) TABLE Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
TABLE Authors ( Authors.author_name (VARCHAR(255)), Authors.other_details (VARCHAR(255)), ) TABLE Business_Processes ( Business_Processes.process_id (INTEGER), Business_Processes.next_process_id (INTEGER), Business_Processes.process_name (VARCHAR(255)), Business_Processes.process_description (VARCHAR(255)), Business_Processes.other_details (VARCHAR(255)), ) TABLE Documents ( Documents.document_id (INTEGER), Documents.author_name (VARCHAR(255)), Documents.document_name (VARCHAR(255)), Documents.document_description (VARCHAR(255)), Documents.other_details (VARCHAR(255)), ) TABLE Documents_Processes ( Documents_Processes.document_id (INTEGER), Documents_Processes.process_id (INTEGER), Documents_Processes.process_outcome_code (CHAR(15)), Documents_Processes.process_status_code (CHAR(15)), ) TABLE Process_Outcomes ( Process_Outcomes.process_outcome_code (CHAR(15)), Process_Outcomes.process_outcome_description (VARCHAR(255)), ) TABLE Process_Status ( Process_Status.process_status_code (CHAR(15)), Process_Status.process_status_description (VARCHAR(255)), ) TABLE Ref_Staff_Roles ( Ref_Staff_Roles.staff_role_code (CHAR(15)), Ref_Staff_Roles.staff_role_description (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Processes ( Staff_in_Processes.document_id (INTEGER), Staff_in_Processes.process_id (INTEGER), Staff_in_Processes.staff_id (INTEGER), Staff_in_Processes.staff_role_code (CHAR(15)), Staff_in_Processes.date_from (DATETIME), Staff_in_Processes.date_to (DATETIME), Staff_in_Processes.other_details (VARCHAR(255)), ) Possible JOINs: Documents.author_name = Authors.author_name Documents_Processes.document_id = Documents.document_id Documents_Processes.process_id = Business_Processes.process_id Documents_Processes.process_outcome_code = Process_Outcomes.process_outcome_code Documents_Processes.process_status_code = Process_Status.process_status_code Staff_in_Processes.document_id = Documents_Processes.document_id Staff_in_Processes.process_id = Documents_Processes.process_id Staff_in_Processes.staff_id = Staff.staff_id Staff_in_Processes.staff_role_code = Ref_Staff_Roles.staff_role_code
TABLE authors ( authors.author_name (VARCHAR(255)), authors.other_details (VARCHAR(255)), ) TABLE business_processes ( business_processes.process_id (INTEGER), business_processes.next_process_id (INTEGER), business_processes.process_name (VARCHAR(255)), business_processes.process_description (VARCHAR(255)), business_processes.other_details (VARCHAR(255)), ) TABLE documents ( documents.document_id (INTEGER), documents.author_name (VARCHAR(255)), documents.document_name (VARCHAR(255)), documents.document_description (VARCHAR(255)), documents.other_details (VARCHAR(255)), ) TABLE documents_processes ( documents_processes.document_id (INTEGER), documents_processes.process_id (INTEGER), documents_processes.process_outcome_code (CHAR(15)), documents_processes.process_status_code (CHAR(15)), ) TABLE process_outcomes ( process_outcomes.process_outcome_code (CHAR(15)), process_outcomes.process_outcome_description (VARCHAR(255)), ) TABLE process_status ( process_status.process_status_code (CHAR(15)), process_status.process_status_description (VARCHAR(255)), ) TABLE ref_staff_roles ( ref_staff_roles.staff_role_code (CHAR(15)), ref_staff_roles.staff_role_description (VARCHAR(255)), ) TABLE staff ( staff.staff_id (INTEGER), staff.staff_details (VARCHAR(255)), ) TABLE staff_in_processes ( staff_in_processes.document_id (INTEGER), staff_in_processes.process_id (INTEGER), staff_in_processes.staff_id (INTEGER), staff_in_processes.staff_role_code (CHAR(15)), staff_in_processes.date_from (DATETIME), staff_in_processes.date_to (DATETIME), staff_in_processes.other_details (VARCHAR(255)), ) Possible JOINs: documents.author_name = authors.author_name documents_processes.document_id = documents.document_id documents_processes.process_id = business_processes.process_id documents_processes.process_outcome_code = process_outcomes.process_outcome_code documents_processes.process_status_code = process_status.process_status_code staff_in_processes.document_id = documents_processes.document_id staff_in_processes.process_id = documents_processes.process_id staff_in_processes.staff_id = staff.staff_id staff_in_processes.staff_role_code = ref_staff_roles.staff_role_code
boat_1
CREATE TABLE "Boats" ( bid INTEGER, name TEXT, color TEXT, PRIMARY KEY (bid) ) CREATE TABLE "Reserves" ( sid INTEGER, bid INTEGER, day TEXT, FOREIGN KEY(sid) REFERENCES "Sailors" (sid), FOREIGN KEY(bid) REFERENCES "Boats" (bid) ) CREATE TABLE "Sailors" ( sid INTEGER, name TEXT, rating INTEGER, age INTEGER, PRIMARY KEY (sid) )
Find the id and name of the sailors who reserved more than one boat.
medium
Table Boats ( Boats.bid (INTEGER), Boats.name (TEXT), Boats.color (TEXT), ) Table Reserves ( Reserves.sid (INTEGER), Reserves.bid (INTEGER), Reserves.day (TEXT), ) Table Sailors ( Sailors.sid (INTEGER), Sailors.name (TEXT), Sailors.rating (INTEGER), Sailors.age (INTEGER), ) Possible JOINs: Reserves.sid = Sailors.sid Reserves.bid = Boats.bid
SELECT DISTINCT Sailors.name , Sailors.sid FROM Sailors JOIN Reserves ON Sailors.sid = Reserves.sid GROUP BY Reserves.sid HAVING COUNT(*) > 1
{ 'sailors': ['sid', 'name'], 'reserves': ['sid'] }
CREATE TABLE Boats ( Boats.bid (INTEGER), Boats.name (TEXT), Boats.color (TEXT), ) CREATE TABLE Reserves ( Reserves.sid (INTEGER), Reserves.bid (INTEGER), Reserves.day (TEXT), ) CREATE TABLE Sailors ( Sailors.sid (INTEGER), Sailors.name (TEXT), Sailors.rating (INTEGER), Sailors.age (INTEGER), ) Possible JOINs: Reserves.sid = Sailors.sid Reserves.bid = Boats.bid
Table Boats ( Boats.bid (INTEGER), Boats.name (TEXT), Boats.color (TEXT), ) Table Reserves ( Reserves.sid (INTEGER), Reserves.bid (INTEGER), Reserves.day (TEXT), ) Table Sailors ( Sailors.sid (INTEGER), Sailors.name (TEXT), Sailors.rating (INTEGER), Sailors.age (INTEGER), ) Possible JOINs: Reserves.sid = Sailors.sid Reserves.bid = Boats.bid
CREATE TABLE Boats ( Boats.bid (INTEGER), Boats.name (TEXT), Boats.color (TEXT), ) CREATE TABLE Reserves ( Reserves.sid (INTEGER), Reserves.bid (INTEGER), Reserves.day (TEXT), ) CREATE TABLE Sailors ( Sailors.sid (INTEGER), Sailors.name (TEXT), Sailors.rating (INTEGER), Sailors.age (INTEGER), ) Possible JOINs: Reserves.sid = Sailors.sid Reserves.bid = Boats.bid
Table boats ( boats.bid (INTEGER), boats.name (TEXT), boats.color (TEXT), ) Table reserves ( reserves.sid (INTEGER), reserves.bid (INTEGER), reserves.day (TEXT), ) Table sailors ( sailors.sid (INTEGER), sailors.name (TEXT), sailors.rating (INTEGER), sailors.age (INTEGER), ) Possible JOINs: reserves.sid = sailors.sid reserves.bid = boats.bid
CREATE TABLE boats ( boats.bid (INTEGER), boats.name (TEXT), boats.color (TEXT), ) CREATE TABLE reserves ( reserves.sid (INTEGER), reserves.bid (INTEGER), reserves.day (TEXT), ) CREATE TABLE sailors ( sailors.sid (INTEGER), sailors.name (TEXT), sailors.rating (INTEGER), sailors.age (INTEGER), ) Possible JOINs: reserves.sid = sailors.sid reserves.bid = boats.bid
{ 'Sailors': ['sid', 'name', 'rating', 'age'], 'Boats': ['bid', 'name', 'color'], 'Reserves': ['sid', 'bid', 'day'] }
{ 'Sailors': ['sid', 'name'], 'Reserves': ['sid'] }
TABLE Boats ( Boats.bid (INTEGER), Boats.name (TEXT), Boats.color (TEXT), ) TABLE Reserves ( Reserves.sid (INTEGER), Reserves.bid (INTEGER), Reserves.day (TEXT), ) TABLE Sailors ( Sailors.sid (INTEGER), Sailors.name (TEXT), Sailors.rating (INTEGER), Sailors.age (INTEGER), ) Possible JOINs: Reserves.sid = Sailors.sid Reserves.bid = Boats.bid
TABLE Boats ( Boats.bid (INTEGER), Boats.name (TEXT), Boats.color (TEXT), ) TABLE Reserves ( Reserves.sid (INTEGER), Reserves.bid (INTEGER), Reserves.day (TEXT), ) TABLE Sailors ( Sailors.sid (INTEGER), Sailors.name (TEXT), Sailors.rating (INTEGER), Sailors.age (INTEGER), ) Possible JOINs: Reserves.sid = Sailors.sid Reserves.bid = Boats.bid
TABLE boats ( boats.bid (INTEGER), boats.name (TEXT), boats.color (TEXT), ) TABLE reserves ( reserves.sid (INTEGER), reserves.bid (INTEGER), reserves.day (TEXT), ) TABLE sailors ( sailors.sid (INTEGER), sailors.name (TEXT), sailors.rating (INTEGER), sailors.age (INTEGER), ) Possible JOINs: reserves.sid = sailors.sid reserves.bid = boats.bid
art_1
CREATE TABLE "Artists" ( "artistID" INTEGER, lname TEXT, fname TEXT, "birthYear" INTEGER, "deathYear" INTEGER, PRIMARY KEY ("artistID") ) CREATE TABLE "Paintings" ( "paintingID" INTEGER, title TEXT, year INTEGER, height_mm INTEGER, width_mm INTEGER, medium TEXT, "mediumOn" TEXT, location TEXT, "painterID" INTEGER, PRIMARY KEY ("paintingID"), FOREIGN KEY("painterID") REFERENCES "Artists" ("artistID") ) CREATE TABLE "Sculptures" ( "sculptureID" INTEGER, title TEXT, year INTEGER, medium TEXT, location TEXT, "sculptorID" INTEGER, PRIMARY KEY ("sculptureID"), FOREIGN KEY("sculptorID") REFERENCES "Artists" ("artistID") )
What is the birth year of each distinct artists who created sculptures after 1920?
medium
Table Artists ( Artists.artistID (INTEGER), Artists.lname (TEXT), Artists.fname (TEXT), Artists.birthYear (INTEGER), Artists.deathYear (INTEGER), ) Table Paintings ( Paintings.paintingID (INTEGER), Paintings.title (TEXT), Paintings.year (INTEGER), Paintings.height_mm (INTEGER), Paintings.width_mm (INTEGER), Paintings.medium (TEXT), Paintings.mediumOn (TEXT), Paintings.location (TEXT), Paintings.painterID (INTEGER), ) Table Sculptures ( Sculptures.sculptureID (INTEGER), Sculptures.title (TEXT), Sculptures.year (INTEGER), Sculptures.medium (TEXT), Sculptures.location (TEXT), Sculptures.sculptorID (INTEGER), ) Possible JOINs: Paintings.painterID = Artists.artistID Sculptures.sculptorID = Artists.artistID
SELECT DISTINCT artists.birthYear FROM artists JOIN sculptures ON artists.artistID = sculptures.sculptorID WHERE sculptures.year > 1920
{ 'artists': ['artistid', 'birthyear'], 'sculptures': ['sculptureid', 'year', 'sculptorid'] }
CREATE TABLE Artists ( Artists.artistID (INTEGER), Artists.lname (TEXT), Artists.fname (TEXT), Artists.birthYear (INTEGER), Artists.deathYear (INTEGER), ) CREATE TABLE Paintings ( Paintings.paintingID (INTEGER), Paintings.title (TEXT), Paintings.year (INTEGER), Paintings.height_mm (INTEGER), Paintings.width_mm (INTEGER), Paintings.medium (TEXT), Paintings.mediumOn (TEXT), Paintings.location (TEXT), Paintings.painterID (INTEGER), ) CREATE TABLE Sculptures ( Sculptures.sculptureID (INTEGER), Sculptures.title (TEXT), Sculptures.year (INTEGER), Sculptures.medium (TEXT), Sculptures.location (TEXT), Sculptures.sculptorID (INTEGER), ) Possible JOINs: Paintings.painterID = Artists.artistID Sculptures.sculptorID = Artists.artistID
Table Artists ( Artists.artistid (INTEGER), Artists.lname (TEXT), Artists.fname (TEXT), Artists.birthyear (INTEGER), Artists.deathyear (INTEGER), ) Table Paintings ( Paintings.paintingid (INTEGER), Paintings.title (TEXT), Paintings.year (INTEGER), Paintings.height_mm (INTEGER), Paintings.width_mm (INTEGER), Paintings.medium (TEXT), Paintings.mediumon (TEXT), Paintings.location (TEXT), Paintings.painterid (INTEGER), ) Table Sculptures ( Sculptures.sculptureid (INTEGER), Sculptures.title (TEXT), Sculptures.year (INTEGER), Sculptures.medium (TEXT), Sculptures.location (TEXT), Sculptures.sculptorid (INTEGER), ) Possible JOINs: Paintings.painterid = Artists.artistid Sculptures.sculptorid = Artists.artistid
CREATE TABLE Artists ( Artists.artistid (INTEGER), Artists.lname (TEXT), Artists.fname (TEXT), Artists.birthyear (INTEGER), Artists.deathyear (INTEGER), ) CREATE TABLE Paintings ( Paintings.paintingid (INTEGER), Paintings.title (TEXT), Paintings.year (INTEGER), Paintings.height_mm (INTEGER), Paintings.width_mm (INTEGER), Paintings.medium (TEXT), Paintings.mediumon (TEXT), Paintings.location (TEXT), Paintings.painterid (INTEGER), ) CREATE TABLE Sculptures ( Sculptures.sculptureid (INTEGER), Sculptures.title (TEXT), Sculptures.year (INTEGER), Sculptures.medium (TEXT), Sculptures.location (TEXT), Sculptures.sculptorid (INTEGER), ) Possible JOINs: Paintings.painterid = Artists.artistid Sculptures.sculptorid = Artists.artistid
Table artists ( artists.artistid (INTEGER), artists.lname (TEXT), artists.fname (TEXT), artists.birthyear (INTEGER), artists.deathyear (INTEGER), ) Table paintings ( paintings.paintingid (INTEGER), paintings.title (TEXT), paintings.year (INTEGER), paintings.height_mm (INTEGER), paintings.width_mm (INTEGER), paintings.medium (TEXT), paintings.mediumon (TEXT), paintings.location (TEXT), paintings.painterid (INTEGER), ) Table sculptures ( sculptures.sculptureid (INTEGER), sculptures.title (TEXT), sculptures.year (INTEGER), sculptures.medium (TEXT), sculptures.location (TEXT), sculptures.sculptorid (INTEGER), ) Possible JOINs: paintings.painterid = artists.artistid sculptures.sculptorid = artists.artistid
CREATE TABLE artists ( artists.artistid (INTEGER), artists.lname (TEXT), artists.fname (TEXT), artists.birthyear (INTEGER), artists.deathyear (INTEGER), ) CREATE TABLE paintings ( paintings.paintingid (INTEGER), paintings.title (TEXT), paintings.year (INTEGER), paintings.height_mm (INTEGER), paintings.width_mm (INTEGER), paintings.medium (TEXT), paintings.mediumon (TEXT), paintings.location (TEXT), paintings.painterid (INTEGER), ) CREATE TABLE sculptures ( sculptures.sculptureid (INTEGER), sculptures.title (TEXT), sculptures.year (INTEGER), sculptures.medium (TEXT), sculptures.location (TEXT), sculptures.sculptorid (INTEGER), ) Possible JOINs: paintings.painterid = artists.artistid sculptures.sculptorid = artists.artistid
{ 'Artists': ['artistID', 'lname', 'fname', 'birthYear', 'deathYear'], 'Paintings': ['paintingID', 'title', 'year', 'height_mm', 'width_mm', 'medium', 'mediumOn', 'location', 'painterID'], 'Sculptures': ['sculptureID', 'title', 'year', 'medium', 'location', 'sculptorID'] }
{ 'Artists': ['artistID', 'birthYear'], 'Sculptures': ['sculptureID', 'year', 'sculptorID'] }
TABLE Artists ( Artists.artistID (INTEGER), Artists.lname (TEXT), Artists.fname (TEXT), Artists.birthYear (INTEGER), Artists.deathYear (INTEGER), ) TABLE Paintings ( Paintings.paintingID (INTEGER), Paintings.title (TEXT), Paintings.year (INTEGER), Paintings.height_mm (INTEGER), Paintings.width_mm (INTEGER), Paintings.medium (TEXT), Paintings.mediumOn (TEXT), Paintings.location (TEXT), Paintings.painterID (INTEGER), ) TABLE Sculptures ( Sculptures.sculptureID (INTEGER), Sculptures.title (TEXT), Sculptures.year (INTEGER), Sculptures.medium (TEXT), Sculptures.location (TEXT), Sculptures.sculptorID (INTEGER), ) Possible JOINs: Paintings.painterID = Artists.artistID Sculptures.sculptorID = Artists.artistID
TABLE Artists ( Artists.artistid (INTEGER), Artists.lname (TEXT), Artists.fname (TEXT), Artists.birthyear (INTEGER), Artists.deathyear (INTEGER), ) TABLE Paintings ( Paintings.paintingid (INTEGER), Paintings.title (TEXT), Paintings.year (INTEGER), Paintings.height_mm (INTEGER), Paintings.width_mm (INTEGER), Paintings.medium (TEXT), Paintings.mediumon (TEXT), Paintings.location (TEXT), Paintings.painterid (INTEGER), ) TABLE Sculptures ( Sculptures.sculptureid (INTEGER), Sculptures.title (TEXT), Sculptures.year (INTEGER), Sculptures.medium (TEXT), Sculptures.location (TEXT), Sculptures.sculptorid (INTEGER), ) Possible JOINs: Paintings.painterid = Artists.artistid Sculptures.sculptorid = Artists.artistid
TABLE artists ( artists.artistid (INTEGER), artists.lname (TEXT), artists.fname (TEXT), artists.birthyear (INTEGER), artists.deathyear (INTEGER), ) TABLE paintings ( paintings.paintingid (INTEGER), paintings.title (TEXT), paintings.year (INTEGER), paintings.height_mm (INTEGER), paintings.width_mm (INTEGER), paintings.medium (TEXT), paintings.mediumon (TEXT), paintings.location (TEXT), paintings.painterid (INTEGER), ) TABLE sculptures ( sculptures.sculptureid (INTEGER), sculptures.title (TEXT), sculptures.year (INTEGER), sculptures.medium (TEXT), sculptures.location (TEXT), sculptures.sculptorid (INTEGER), ) Possible JOINs: paintings.painterid = artists.artistid sculptures.sculptorid = artists.artistid
warehouse_1
CREATE TABLE "Boxes" ( "Code" CHAR(4) NOT NULL, "Contents" VARCHAR(255) NOT NULL, "Value" REAL NOT NULL, "Warehouse" INTEGER NOT NULL, PRIMARY KEY ("Code"), FOREIGN KEY("Warehouse") REFERENCES "Warehouses" ("Code") ) CREATE TABLE "Warehouses" ( "Code" INTEGER NOT NULL, "Location" VARCHAR(255) NOT NULL, "Capacity" INTEGER NOT NULL, PRIMARY KEY ("Code") )
What are the distinct warehouses that have boxes with Rocks or Scissors as contents?
medium
Table Boxes ( Boxes.Code (CHAR(4)), Boxes.Contents (VARCHAR(255)), Boxes.Value (REAL), Boxes.Warehouse (INTEGER), ) Table Warehouses ( Warehouses.Code (INTEGER), Warehouses.Location (VARCHAR(255)), Warehouses.Capacity (INTEGER), ) Possible JOINs: Boxes.Warehouse = Warehouses.Code
SELECT DISTINCT warehouse FROM boxes WHERE CONTENTS = 'Rocks' OR CONTENTS = 'Scissors'
{ 'boxes': ['code', 'contents', 'warehouse'] }
CREATE TABLE Boxes ( Boxes.Code (CHAR(4)), Boxes.Contents (VARCHAR(255)), Boxes.Value (REAL), Boxes.Warehouse (INTEGER), ) CREATE TABLE Warehouses ( Warehouses.Code (INTEGER), Warehouses.Location (VARCHAR(255)), Warehouses.Capacity (INTEGER), ) Possible JOINs: Boxes.Warehouse = Warehouses.Code
Table Boxes ( Boxes.code (CHAR(4)), Boxes.contents (VARCHAR(255)), Boxes.value (REAL), Boxes.warehouse (INTEGER), ) Table Warehouses ( Warehouses.code (INTEGER), Warehouses.location (VARCHAR(255)), Warehouses.capacity (INTEGER), ) Possible JOINs: Boxes.warehouse = Warehouses.code
CREATE TABLE Boxes ( Boxes.code (CHAR(4)), Boxes.contents (VARCHAR(255)), Boxes.value (REAL), Boxes.warehouse (INTEGER), ) CREATE TABLE Warehouses ( Warehouses.code (INTEGER), Warehouses.location (VARCHAR(255)), Warehouses.capacity (INTEGER), ) Possible JOINs: Boxes.warehouse = Warehouses.code
Table boxes ( boxes.code (CHAR(4)), boxes.contents (VARCHAR(255)), boxes.value (REAL), boxes.warehouse (INTEGER), ) Table warehouses ( warehouses.code (INTEGER), warehouses.location (VARCHAR(255)), warehouses.capacity (INTEGER), ) Possible JOINs: boxes.warehouse = warehouses.code
CREATE TABLE boxes ( boxes.code (CHAR(4)), boxes.contents (VARCHAR(255)), boxes.value (REAL), boxes.warehouse (INTEGER), ) CREATE TABLE warehouses ( warehouses.code (INTEGER), warehouses.location (VARCHAR(255)), warehouses.capacity (INTEGER), ) Possible JOINs: boxes.warehouse = warehouses.code
{ 'Warehouses': ['Code', 'Location', 'Capacity'], 'Boxes': ['Code', 'Contents', 'Value', 'Warehouse'] }
{ 'Boxes': ['Code', 'Contents', 'Warehouse'] }
TABLE Boxes ( Boxes.Code (CHAR(4)), Boxes.Contents (VARCHAR(255)), Boxes.Value (REAL), Boxes.Warehouse (INTEGER), ) TABLE Warehouses ( Warehouses.Code (INTEGER), Warehouses.Location (VARCHAR(255)), Warehouses.Capacity (INTEGER), ) Possible JOINs: Boxes.Warehouse = Warehouses.Code
TABLE Boxes ( Boxes.code (CHAR(4)), Boxes.contents (VARCHAR(255)), Boxes.value (REAL), Boxes.warehouse (INTEGER), ) TABLE Warehouses ( Warehouses.code (INTEGER), Warehouses.location (VARCHAR(255)), Warehouses.capacity (INTEGER), ) Possible JOINs: Boxes.warehouse = Warehouses.code
TABLE boxes ( boxes.code (CHAR(4)), boxes.contents (VARCHAR(255)), boxes.value (REAL), boxes.warehouse (INTEGER), ) TABLE warehouses ( warehouses.code (INTEGER), warehouses.location (VARCHAR(255)), warehouses.capacity (INTEGER), ) Possible JOINs: boxes.warehouse = warehouses.code
aan_1
CREATE TABLE "Affiliation" ( affiliation_id INTEGER NOT NULL, name VARCHAR(255) DEFAULT NULL, address VARCHAR(255) DEFAULT NULL, PRIMARY KEY (affiliation_id) ) CREATE TABLE "Author" ( author_id INTEGER NOT NULL, name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, PRIMARY KEY (author_id) ) CREATE TABLE "Author_list" ( paper_id VARCHAR(25) NOT NULL, author_id INTEGER NOT NULL, affiliation_id INTEGER DEFAULT NULL, PRIMARY KEY (paper_id, author_id), FOREIGN KEY(affiliation_id) REFERENCES "Affiliation" (affiliation_id), FOREIGN KEY(author_id) REFERENCES "Author" (author_id), FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id) ) CREATE TABLE "Citation" ( paper_id VARCHAR(25) NOT NULL, cited_paper_id VARCHAR(25) NOT NULL, PRIMARY KEY (paper_id, cited_paper_id), FOREIGN KEY(cited_paper_id) REFERENCES "Paper" (paper_id), FOREIGN KEY(paper_id) REFERENCES "Paper" (paper_id) ) CREATE TABLE "Paper" ( paper_id VARCHAR(25) NOT NULL, title VARCHAR(255) DEFAULT NULL, venue VARCHAR(255) DEFAULT NULL, year INTEGER DEFAULT NULL, PRIMARY KEY (paper_id) )
How many papers cite paper with id A00-1002?
easy
Table Affiliation ( Affiliation.affiliation_id (INTEGER), Affiliation.name (varchar(255)), Affiliation.address (varchar(255)), ) Table Author ( Author.author_id (INTEGER), Author.name (varchar(255)), Author.email (varchar(255)), ) Table Author_list ( Author_list.paper_id (varchar(25)), Author_list.author_id (INTEGER), Author_list.affiliation_id (INTEGER), ) Table Citation ( Citation.paper_id (varchar(25)), Citation.cited_paper_id (varchar(25)), ) Table Paper ( Paper.paper_id (varchar(25)), Paper.title (varchar(255)), Paper.venue (varchar(255)), Paper.year (INTEGER), ) Possible JOINs: Author_list.paper_id = Paper.paper_id Author_list.author_id = Author.author_id Author_list.affiliation_id = Affiliation.affiliation_id Citation.paper_id = Paper.paper_id Citation.cited_paper_id = Paper.paper_id
SELECT count(*) FROM Citation WHERE cited_paper_id = "A00-1002"
{ 'citation': ['paper_id', 'cited_paper_id'] }
CREATE TABLE Affiliation ( Affiliation.affiliation_id (INTEGER), Affiliation.name (varchar(255)), Affiliation.address (varchar(255)), ) CREATE TABLE Author ( Author.author_id (INTEGER), Author.name (varchar(255)), Author.email (varchar(255)), ) CREATE TABLE Author_list ( Author_list.paper_id (varchar(25)), Author_list.author_id (INTEGER), Author_list.affiliation_id (INTEGER), ) CREATE TABLE Citation ( Citation.paper_id (varchar(25)), Citation.cited_paper_id (varchar(25)), ) CREATE TABLE Paper ( Paper.paper_id (varchar(25)), Paper.title (varchar(255)), Paper.venue (varchar(255)), Paper.year (INTEGER), ) Possible JOINs: Author_list.paper_id = Paper.paper_id Author_list.author_id = Author.author_id Author_list.affiliation_id = Affiliation.affiliation_id Citation.paper_id = Paper.paper_id Citation.cited_paper_id = Paper.paper_id
Table Affiliation ( Affiliation.affiliation_id (INTEGER), Affiliation.name (varchar(255)), Affiliation.address (varchar(255)), ) Table Author ( Author.author_id (INTEGER), Author.name (varchar(255)), Author.email (varchar(255)), ) Table Author_list ( Author_list.paper_id (varchar(25)), Author_list.author_id (INTEGER), Author_list.affiliation_id (INTEGER), ) Table Citation ( Citation.paper_id (varchar(25)), Citation.cited_paper_id (varchar(25)), ) Table Paper ( Paper.paper_id (varchar(25)), Paper.title (varchar(255)), Paper.venue (varchar(255)), Paper.year (INTEGER), ) Possible JOINs: Author_list.paper_id = Paper.paper_id Author_list.author_id = Author.author_id Author_list.affiliation_id = Affiliation.affiliation_id Citation.paper_id = Paper.paper_id Citation.cited_paper_id = Paper.paper_id
CREATE TABLE Affiliation ( Affiliation.affiliation_id (INTEGER), Affiliation.name (varchar(255)), Affiliation.address (varchar(255)), ) CREATE TABLE Author ( Author.author_id (INTEGER), Author.name (varchar(255)), Author.email (varchar(255)), ) CREATE TABLE Author_list ( Author_list.paper_id (varchar(25)), Author_list.author_id (INTEGER), Author_list.affiliation_id (INTEGER), ) CREATE TABLE Citation ( Citation.paper_id (varchar(25)), Citation.cited_paper_id (varchar(25)), ) CREATE TABLE Paper ( Paper.paper_id (varchar(25)), Paper.title (varchar(255)), Paper.venue (varchar(255)), Paper.year (INTEGER), ) Possible JOINs: Author_list.paper_id = Paper.paper_id Author_list.author_id = Author.author_id Author_list.affiliation_id = Affiliation.affiliation_id Citation.paper_id = Paper.paper_id Citation.cited_paper_id = Paper.paper_id
Table affiliation ( affiliation.affiliation_id (INTEGER), affiliation.name (varchar(255)), affiliation.address (varchar(255)), ) Table author ( author.author_id (INTEGER), author.name (varchar(255)), author.email (varchar(255)), ) Table author_list ( author_list.paper_id (varchar(25)), author_list.author_id (INTEGER), author_list.affiliation_id (INTEGER), ) Table citation ( citation.paper_id (varchar(25)), citation.cited_paper_id (varchar(25)), ) Table paper ( paper.paper_id (varchar(25)), paper.title (varchar(255)), paper.venue (varchar(255)), paper.year (INTEGER), ) Possible JOINs: author_list.paper_id = paper.paper_id author_list.author_id = author.author_id author_list.affiliation_id = affiliation.affiliation_id citation.paper_id = paper.paper_id citation.cited_paper_id = paper.paper_id
CREATE TABLE affiliation ( affiliation.affiliation_id (INTEGER), affiliation.name (varchar(255)), affiliation.address (varchar(255)), ) CREATE TABLE author ( author.author_id (INTEGER), author.name (varchar(255)), author.email (varchar(255)), ) CREATE TABLE author_list ( author_list.paper_id (varchar(25)), author_list.author_id (INTEGER), author_list.affiliation_id (INTEGER), ) CREATE TABLE citation ( citation.paper_id (varchar(25)), citation.cited_paper_id (varchar(25)), ) CREATE TABLE paper ( paper.paper_id (varchar(25)), paper.title (varchar(255)), paper.venue (varchar(255)), paper.year (INTEGER), ) Possible JOINs: author_list.paper_id = paper.paper_id author_list.author_id = author.author_id author_list.affiliation_id = affiliation.affiliation_id citation.paper_id = paper.paper_id citation.cited_paper_id = paper.paper_id
{ 'Affiliation': ['affiliation_id', 'name', 'address'], 'Author': ['author_id', 'name', 'email'], 'Author_list': ['paper_id', 'author_id', 'affiliation_id'], 'Citation': ['paper_id', 'cited_paper_id'], 'Paper': ['paper_id', 'title', 'venue', 'year'] }
{ 'Citation': ['paper_id', 'cited_paper_id'] }
TABLE Affiliation ( Affiliation.affiliation_id (INTEGER), Affiliation.name (varchar(255)), Affiliation.address (varchar(255)), ) TABLE Author ( Author.author_id (INTEGER), Author.name (varchar(255)), Author.email (varchar(255)), ) TABLE Author_list ( Author_list.paper_id (varchar(25)), Author_list.author_id (INTEGER), Author_list.affiliation_id (INTEGER), ) TABLE Citation ( Citation.paper_id (varchar(25)), Citation.cited_paper_id (varchar(25)), ) TABLE Paper ( Paper.paper_id (varchar(25)), Paper.title (varchar(255)), Paper.venue (varchar(255)), Paper.year (INTEGER), ) Possible JOINs: Author_list.paper_id = Paper.paper_id Author_list.author_id = Author.author_id Author_list.affiliation_id = Affiliation.affiliation_id Citation.paper_id = Paper.paper_id Citation.cited_paper_id = Paper.paper_id
TABLE Affiliation ( Affiliation.affiliation_id (INTEGER), Affiliation.name (varchar(255)), Affiliation.address (varchar(255)), ) TABLE Author ( Author.author_id (INTEGER), Author.name (varchar(255)), Author.email (varchar(255)), ) TABLE Author_list ( Author_list.paper_id (varchar(25)), Author_list.author_id (INTEGER), Author_list.affiliation_id (INTEGER), ) TABLE Citation ( Citation.paper_id (varchar(25)), Citation.cited_paper_id (varchar(25)), ) TABLE Paper ( Paper.paper_id (varchar(25)), Paper.title (varchar(255)), Paper.venue (varchar(255)), Paper.year (INTEGER), ) Possible JOINs: Author_list.paper_id = Paper.paper_id Author_list.author_id = Author.author_id Author_list.affiliation_id = Affiliation.affiliation_id Citation.paper_id = Paper.paper_id Citation.cited_paper_id = Paper.paper_id
TABLE affiliation ( affiliation.affiliation_id (INTEGER), affiliation.name (varchar(255)), affiliation.address (varchar(255)), ) TABLE author ( author.author_id (INTEGER), author.name (varchar(255)), author.email (varchar(255)), ) TABLE author_list ( author_list.paper_id (varchar(25)), author_list.author_id (INTEGER), author_list.affiliation_id (INTEGER), ) TABLE citation ( citation.paper_id (varchar(25)), citation.cited_paper_id (varchar(25)), ) TABLE paper ( paper.paper_id (varchar(25)), paper.title (varchar(255)), paper.venue (varchar(255)), paper.year (INTEGER), ) Possible JOINs: author_list.paper_id = paper.paper_id author_list.author_id = author.author_id author_list.affiliation_id = affiliation.affiliation_id citation.paper_id = paper.paper_id citation.cited_paper_id = paper.paper_id
movie_2
CREATE TABLE "MovieTheaters" ( "Code" INTEGER, "Name" VARCHAR(255) NOT NULL, "Movie" INTEGER, PRIMARY KEY ("Code"), FOREIGN KEY("Movie") REFERENCES "Movies" ("Code") ) CREATE TABLE "Movies" ( "Code" INTEGER, "Title" VARCHAR(255) NOT NULL, "Rating" VARCHAR(255), PRIMARY KEY ("Code") )
What are the movie names sorted by rating?
easy
Table MovieTheaters ( MovieTheaters.Code (INTEGER), MovieTheaters.Name (VARCHAR(255)), MovieTheaters.Movie (INTEGER), ) Table Movies ( Movies.Code (INTEGER), Movies.Title (VARCHAR(255)), Movies.Rating (VARCHAR(255)), ) Possible JOINs: MovieTheaters.Movie = Movies.Code
SELECT title FROM movies ORDER BY rating
{ 'movies': ['code', 'title', 'rating'] }
CREATE TABLE MovieTheaters ( MovieTheaters.Code (INTEGER), MovieTheaters.Name (VARCHAR(255)), MovieTheaters.Movie (INTEGER), ) CREATE TABLE Movies ( Movies.Code (INTEGER), Movies.Title (VARCHAR(255)), Movies.Rating (VARCHAR(255)), ) Possible JOINs: MovieTheaters.Movie = Movies.Code
Table MovieTheaters ( MovieTheaters.code (INTEGER), MovieTheaters.name (VARCHAR(255)), MovieTheaters.movie (INTEGER), ) Table Movies ( Movies.code (INTEGER), Movies.title (VARCHAR(255)), Movies.rating (VARCHAR(255)), ) Possible JOINs: MovieTheaters.movie = Movies.code
CREATE TABLE MovieTheaters ( MovieTheaters.code (INTEGER), MovieTheaters.name (VARCHAR(255)), MovieTheaters.movie (INTEGER), ) CREATE TABLE Movies ( Movies.code (INTEGER), Movies.title (VARCHAR(255)), Movies.rating (VARCHAR(255)), ) Possible JOINs: MovieTheaters.movie = Movies.code
Table movietheaters ( movietheaters.code (INTEGER), movietheaters.name (VARCHAR(255)), movietheaters.movie (INTEGER), ) Table movies ( movies.code (INTEGER), movies.title (VARCHAR(255)), movies.rating (VARCHAR(255)), ) Possible JOINs: movietheaters.movie = movies.code
CREATE TABLE movietheaters ( movietheaters.code (INTEGER), movietheaters.name (VARCHAR(255)), movietheaters.movie (INTEGER), ) CREATE TABLE movies ( movies.code (INTEGER), movies.title (VARCHAR(255)), movies.rating (VARCHAR(255)), ) Possible JOINs: movietheaters.movie = movies.code
{ 'Movies': ['Code', 'Title', 'Rating'], 'MovieTheaters': ['Code', 'Name', 'Movie'] }
{ 'Movies': ['Code', 'Title', 'Rating'] }
TABLE MovieTheaters ( MovieTheaters.Code (INTEGER), MovieTheaters.Name (VARCHAR(255)), MovieTheaters.Movie (INTEGER), ) TABLE Movies ( Movies.Code (INTEGER), Movies.Title (VARCHAR(255)), Movies.Rating (VARCHAR(255)), ) Possible JOINs: MovieTheaters.Movie = Movies.Code
TABLE MovieTheaters ( MovieTheaters.code (INTEGER), MovieTheaters.name (VARCHAR(255)), MovieTheaters.movie (INTEGER), ) TABLE Movies ( Movies.code (INTEGER), Movies.title (VARCHAR(255)), Movies.rating (VARCHAR(255)), ) Possible JOINs: MovieTheaters.movie = Movies.code
TABLE movietheaters ( movietheaters.code (INTEGER), movietheaters.name (VARCHAR(255)), movietheaters.movie (INTEGER), ) TABLE movies ( movies.code (INTEGER), movies.title (VARCHAR(255)), movies.rating (VARCHAR(255)), ) Possible JOINs: movietheaters.movie = movies.code
car_racing
CREATE TABLE "country" ( "Country_Id" int, "Country" text, "Capital" text, "Official_native_language" text, "Regoin" text, PRIMARY KEY ("Country_Id") ) /* 0 rows from country table: Country_Id Country Capital Official_native_language Regoin */ CREATE TABLE `team` ( "Team_ID" int, "Team" text, "Make" text, "Manager" text, "Sponsor" text, "Car_Owner" text, PRIMARY KEY ("Team_ID") ) /* 0 rows from team table: Team_ID Team Make Manager Sponsor Car_Owner */ CREATE TABLE `driver` ( "Driver_ID" int, "Driver" text, "Country" int, "Age" int, "Car_#" real, "Make" text, "Points" text, "Laps" real, "Winnings" text, PRIMARY KEY ("Driver_ID"), FOREIGN KEY (`Country`) REFERENCES `country`(`Country_ID`) ) /* 0 rows from driver table: Driver_ID Driver Country Age Car_# Make Points Laps Winnings */ CREATE TABLE `team_driver` ( "Team_ID" int, "Driver_ID" int, PRIMARY KEY ("Team_ID","Driver_ID"), FOREIGN KEY (`Team_ID`) REFERENCES `team`(`Team_ID`), FOREIGN KEY (`Driver_ID`) REFERENCES `driver`(`Driver_ID`) ) /* 0 rows from team_driver table: Team_ID Driver_ID */
Find the make that has more than one team.
easy
Table country ( country.Country_Id (INT), country.Country (TEXT), country.Capital (TEXT), country.Official_native_language (TEXT), country.Regoin (TEXT), ) Table driver ( driver.Driver_ID (INT), driver.Driver (TEXT), driver.Country (INT), driver.Age (INT), driver.Car_# (REAL), driver.Make (TEXT), driver.Points (TEXT), driver.Laps (REAL), driver.Winnings (TEXT), ) Table team ( team.Team_ID (INT), team.Team (TEXT), team.Make (TEXT), team.Manager (TEXT), team.Sponsor (TEXT), team.Car_Owner (TEXT), ) Table team_driver ( team_driver.Team_ID (INT), team_driver.Driver_ID (INT), ) Possible JOINs: driver.Country = country.Country_ID team_driver.Team_ID = team.Team_ID team_driver.Driver_ID = driver.Driver_ID
SELECT make FROM team GROUP BY team HAVING count(*) > 1
{ 'team': ['team_id', 'team', 'make'] }
CREATE TABLE country ( country.Country_Id (INT), country.Country (TEXT), country.Capital (TEXT), country.Official_native_language (TEXT), country.Regoin (TEXT), ) CREATE TABLE driver ( driver.Driver_ID (INT), driver.Driver (TEXT), driver.Country (INT), driver.Age (INT), driver.Car_# (REAL), driver.Make (TEXT), driver.Points (TEXT), driver.Laps (REAL), driver.Winnings (TEXT), ) CREATE TABLE team ( team.Team_ID (INT), team.Team (TEXT), team.Make (TEXT), team.Manager (TEXT), team.Sponsor (TEXT), team.Car_Owner (TEXT), ) CREATE TABLE team_driver ( team_driver.Team_ID (INT), team_driver.Driver_ID (INT), ) Possible JOINs: driver.Country = country.Country_ID team_driver.Team_ID = team.Team_ID team_driver.Driver_ID = driver.Driver_ID
Table country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) Table driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) Table team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) Table team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
CREATE TABLE country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) CREATE TABLE driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) CREATE TABLE team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) CREATE TABLE team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
Table country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) Table driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) Table team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) Table team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
CREATE TABLE country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) CREATE TABLE driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) CREATE TABLE team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) CREATE TABLE team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
{ 'country': ['Country_Id', 'Country', 'Capital', 'Official_native_language', 'Regoin'], 'team': ['Team_ID', 'Team', 'Make', 'Manager', 'Sponsor', 'Car_Owner'], 'driver': ['Driver_ID', 'Driver', 'Country', 'Age', 'Car_#', 'Make', 'Points', 'Laps', 'Winnings'], 'team_driver': ['Team_ID', 'Driver_ID'] }
{ 'team': ['Team_ID', 'Team', 'Make'] }
TABLE country ( country.Country_Id (INT), country.Country (TEXT), country.Capital (TEXT), country.Official_native_language (TEXT), country.Regoin (TEXT), ) TABLE driver ( driver.Driver_ID (INT), driver.Driver (TEXT), driver.Country (INT), driver.Age (INT), driver.Car_# (REAL), driver.Make (TEXT), driver.Points (TEXT), driver.Laps (REAL), driver.Winnings (TEXT), ) TABLE team ( team.Team_ID (INT), team.Team (TEXT), team.Make (TEXT), team.Manager (TEXT), team.Sponsor (TEXT), team.Car_Owner (TEXT), ) TABLE team_driver ( team_driver.Team_ID (INT), team_driver.Driver_ID (INT), ) Possible JOINs: driver.Country = country.Country_ID team_driver.Team_ID = team.Team_ID team_driver.Driver_ID = driver.Driver_ID
TABLE country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) TABLE driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) TABLE team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) TABLE team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id
TABLE country ( country.country_id (INT), country.country (TEXT), country.capital (TEXT), country.official_native_language (TEXT), country.regoin (TEXT), ) TABLE driver ( driver.driver_id (INT), driver.driver (TEXT), driver.country (INT), driver.age (INT), driver.car_# (REAL), driver.make (TEXT), driver.points (TEXT), driver.laps (REAL), driver.winnings (TEXT), ) TABLE team ( team.team_id (INT), team.team (TEXT), team.make (TEXT), team.manager (TEXT), team.sponsor (TEXT), team.car_owner (TEXT), ) TABLE team_driver ( team_driver.team_id (INT), team_driver.driver_id (INT), ) Possible JOINs: driver.country = country.country_id team_driver.team_id = team.team_id team_driver.driver_id = driver.driver_id