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
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") )
Return the affiliations of instituions that are not in the city of Vancouver.
easy
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 Affiliation FROM institution WHERE City != "Vancouver"
{ 'institution': ['institution_id', 'city', 'affiliation'] }
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', 'City', 'Affiliation'] }
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
conference
CREATE TABLE conference ( "Conference_ID" INTEGER, "Conference_Name" TEXT, "Year" INTEGER, "Location" TEXT, PRIMARY KEY ("Conference_ID") ) CREATE TABLE conference_participation ( "Conference_ID" INTEGER, "staff_ID" INTEGER, role TEXT, PRIMARY KEY ("staff_ID", "Conference_ID"), FOREIGN KEY("Conference_ID") REFERENCES conference ("Conference_ID"), FOREIGN KEY("staff_ID") REFERENCES staff ("staff_ID") ) CREATE TABLE institution ( "Institution_ID" INTEGER, "Institution_Name" TEXT, "Location" TEXT, "Founded" INTEGER, PRIMARY KEY ("Institution_ID") ) CREATE TABLE staff ( "staff_ID" INTEGER, name TEXT, "Age" INTEGER, "Nationality" TEXT, "Institution_ID" INTEGER, PRIMARY KEY ("staff_ID"), FOREIGN KEY("Institution_ID") REFERENCES institution ("Institution_ID") )
Show all conference names and the number of times each conference has.
medium
Table conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) Table conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) Table institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) Table staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
SELECT conference_name , count(*) FROM conference GROUP BY conference_name
{ 'conference': ['conference_id', 'conference_name'] }
CREATE TABLE conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) CREATE TABLE staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
Table conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) Table conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) Table institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) Table staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
CREATE TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) CREATE TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
Table conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) Table conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) Table institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) Table staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
CREATE TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) CREATE TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
{ 'conference': ['Conference_ID', 'Conference_Name', 'Year', 'Location'], 'institution': ['Institution_ID', 'Institution_Name', 'Location', 'Founded'], 'staff': ['staff_ID', 'name', 'Age', 'Nationality', 'Institution_ID'], 'conference_participation': ['Conference_ID', 'staff_ID', 'role'] }
{ 'conference': ['Conference_ID', 'Conference_Name'] }
TABLE conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) TABLE conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) TABLE staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
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) )
What is the description of the most common property type? List the description and code.
extra
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 Ref_Property_Types.property_type_description , Ref_Property_Types.property_type_code FROM Ref_Property_Types JOIN Properties ON Ref_Property_Types.property_type_code = Properties.property_type_code GROUP BY Ref_Property_Types.property_type_code ORDER BY count(*) DESC LIMIT 1;
{ 'ref_property_types': ['property_type_code', 'property_type_description'], 'properties': ['property_id', 'property_type_code'] }
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'] }
{ 'Ref_Property_Types': ['property_type_code', 'property_type_description'], 'Properties': ['property_id', 'property_type_code'] }
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
cre_Doc_and_collections
CREATE TABLE "Collection_Subset_Members" ( "Collection_ID" INTEGER NOT NULL, "Related_Collection_ID" INTEGER NOT NULL, "Collection_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Collection_ID", "Related_Collection_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Related_Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Collection_Subset_ID") REFERENCES "Collection_Subsets" ("Collection_Subset_ID") ) CREATE TABLE "Collection_Subsets" ( "Collection_Subset_ID" INTEGER NOT NULL, "Collection_Subset_Name" VARCHAR(255) NOT NULL, "Collecrtion_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Collection_Subset_ID") ) CREATE TABLE "Collections" ( "Collection_ID" INTEGER NOT NULL, "Parent_Collection_ID" INTEGER, "Collection_Name" VARCHAR(255), "Collection_Description" VARCHAR(255), PRIMARY KEY ("Collection_ID") ) CREATE TABLE "Document_Objects" ( "Document_Object_ID" INTEGER NOT NULL, "Parent_Document_Object_ID" INTEGER, "Owner" VARCHAR(255), "Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_Object_ID") ) CREATE TABLE "Document_Subset_Members" ( "Document_Object_ID" INTEGER NOT NULL, "Related_Document_Object_ID" INTEGER NOT NULL, "Document_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Related_Document_Object_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Document_Subset_ID") REFERENCES "Document_Subsets" ("Document_Subset_ID"), FOREIGN KEY("Related_Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID") ) CREATE TABLE "Document_Subsets" ( "Document_Subset_ID" INTEGER NOT NULL, "Document_Subset_Name" VARCHAR(255) NOT NULL, "Document_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Subset_ID") ) CREATE TABLE "Documents_in_Collections" ( "Document_Object_ID" INTEGER NOT NULL, "Collection_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Collection_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID") )
List the Collection Name that document owned by 'Ransom ' belong to .
hard
Table Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) Table Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) Table Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
SELECT collections.collection_name FROM collections JOIN documents_in_collections ON collections.collection_id = documents_in_collections.collection_id JOIN document_objects ON documents_in_collections.document_object_id = document_objects.document_object_id WHERE document_objects.owner = 'ransom'
{ 'collections': ['collection_id', 'collection_name'], 'documents_in_collections': ['document_object_id', 'collection_id'], 'document_objects': ['document_object_id', 'owner'] }
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
Table Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) Table Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) Table Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
Table collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) Table collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) Table collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) Table document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) Table document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) Table document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) Table documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
CREATE TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) CREATE TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) CREATE TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) CREATE TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) CREATE TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
{ 'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name', 'Document_Subset_Details'], 'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name', 'Collecrtion_Subset_Details'], 'Document_Objects': ['Document_Object_ID', 'Parent_Document_Object_ID', 'Owner', 'Description', 'Other_Details'], 'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name', 'Collection_Description'], 'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'], 'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'], 'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID', 'Collection_Subset_ID'] }
{ 'Collections': ['Collection_ID', 'Collection_Name'], 'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'], 'Document_Objects': ['Document_Object_ID', 'Owner'] }
TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
advertising_agencies
CREATE TABLE "Agencies" ( agency_id INTEGER, agency_details VARCHAR(255) NOT NULL, PRIMARY KEY (agency_id) ) CREATE TABLE "Clients" ( client_id INTEGER, agency_id INTEGER NOT NULL, sic_code VARCHAR(10) NOT NULL, client_details VARCHAR(255) NOT NULL, PRIMARY KEY (client_id), FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id) ) CREATE TABLE "Invoices" ( invoice_id INTEGER, client_id INTEGER NOT NULL, invoice_status VARCHAR(10) NOT NULL, invoice_details VARCHAR(255) NOT NULL, PRIMARY KEY (invoice_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Meetings" ( meeting_id INTEGER, client_id INTEGER NOT NULL, meeting_outcome VARCHAR(10) NOT NULL, meeting_type VARCHAR(10) NOT NULL, billable_yn VARCHAR(1), start_date_time DATETIME, end_date_time DATETIME, purpose_of_meeting VARCHAR(255), other_details VARCHAR(255) NOT NULL, PRIMARY KEY (meeting_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Payments" ( payment_id INTEGER NOT NULL, invoice_id INTEGER NOT NULL, payment_details VARCHAR(255) NOT NULL, FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, agency_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_in_Meetings" ( meeting_id INTEGER NOT NULL, staff_id INTEGER NOT NULL, FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id) )
Show agency details for client with detail 'Mac'.
medium
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
SELECT Agencies.agency_details FROM Clients JOIN Agencies ON Clients.agency_id = Agencies.agency_id WHERE Clients.client_details = 'Mac'
{ 'clients': ['client_id', 'agency_id', 'client_details'], 'agencies': ['agency_id', 'agency_details'] }
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) Table clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) Table invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) Table meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) Table payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) Table staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) Table staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
CREATE TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) CREATE TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) CREATE TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) CREATE TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) CREATE TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) CREATE TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
{ 'Agencies': ['agency_id', 'agency_details'], 'Staff': ['staff_id', 'agency_id', 'staff_details'], 'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'], 'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'], 'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'], 'Payments': ['payment_id', 'invoice_id', 'payment_details'], 'Staff_in_Meetings': ['meeting_id', 'staff_id'] }
{ 'Clients': ['client_id', 'agency_id', 'client_details'], 'Agencies': ['agency_id', 'agency_details'] }
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
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 does Mckeown , Kathleen cite ?
hard
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 JOIN author_list ON citation.paper_id = author_list.paper_id JOIN author ON author_list.author_id = author.author_id WHERE author.name = "mckeown , kathleen"
{ 'citation': ['paper_id'], 'author_list': ['paper_id', 'author_id'], 'author': ['author_id', 'name'] }
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'], 'Author_list': ['paper_id', 'author_id'], 'Author': ['author_id', 'name'] }
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
club_leader
CREATE TABLE club ( "Club_ID" INTEGER, "Overall_Ranking" INTEGER, "Team_Leader" TEXT, "Club_Name" TEXT, PRIMARY KEY ("Club_ID") ) CREATE TABLE club_leader ( "Club_ID" INTEGER, "Member_ID" INTEGER, "Year_Join" TEXT, PRIMARY KEY ("Club_ID", "Member_ID"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") ) CREATE TABLE member ( "Member_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" INTEGER, PRIMARY KEY ("Member_ID") )
What is the average age of all the club leaders?
easy
Table club ( club.Club_ID (INT), club.Overall_Ranking (INT), club.Team_Leader (TEXT), club.Club_Name (TEXT), ) Table club_leader ( club_leader.Club_ID (INT), club_leader.Member_ID (INT), club_leader.Year_Join (TEXT), ) Table member ( member.Member_ID (INT), member.Name (TEXT), member.Nationality (TEXT), member.Age (INT), ) Possible JOINs: club_leader.Club_ID = club.Club_ID club_leader.Member_ID = member.Member_ID
SELECT avg(member.age) FROM club_leader JOIN member ON club_leader.member_id = member.member_id
{ 'club_leader': ['club_id', 'member_id'], 'member': ['member_id', 'age'] }
CREATE TABLE club ( club.Club_ID (INT), club.Overall_Ranking (INT), club.Team_Leader (TEXT), club.Club_Name (TEXT), ) CREATE TABLE club_leader ( club_leader.Club_ID (INT), club_leader.Member_ID (INT), club_leader.Year_Join (TEXT), ) CREATE TABLE member ( member.Member_ID (INT), member.Name (TEXT), member.Nationality (TEXT), member.Age (INT), ) Possible JOINs: club_leader.Club_ID = club.Club_ID club_leader.Member_ID = member.Member_ID
Table club ( club.club_id (INT), club.overall_ranking (INT), club.team_leader (TEXT), club.club_name (TEXT), ) Table club_leader ( club_leader.club_id (INT), club_leader.member_id (INT), club_leader.year_join (TEXT), ) Table member ( member.member_id (INT), member.name (TEXT), member.nationality (TEXT), member.age (INT), ) Possible JOINs: club_leader.club_id = club.club_id club_leader.member_id = member.member_id
CREATE TABLE club ( club.club_id (INT), club.overall_ranking (INT), club.team_leader (TEXT), club.club_name (TEXT), ) CREATE TABLE club_leader ( club_leader.club_id (INT), club_leader.member_id (INT), club_leader.year_join (TEXT), ) CREATE TABLE member ( member.member_id (INT), member.name (TEXT), member.nationality (TEXT), member.age (INT), ) Possible JOINs: club_leader.club_id = club.club_id club_leader.member_id = member.member_id
Table club ( club.club_id (INT), club.overall_ranking (INT), club.team_leader (TEXT), club.club_name (TEXT), ) Table club_leader ( club_leader.club_id (INT), club_leader.member_id (INT), club_leader.year_join (TEXT), ) Table member ( member.member_id (INT), member.name (TEXT), member.nationality (TEXT), member.age (INT), ) Possible JOINs: club_leader.club_id = club.club_id club_leader.member_id = member.member_id
CREATE TABLE club ( club.club_id (INT), club.overall_ranking (INT), club.team_leader (TEXT), club.club_name (TEXT), ) CREATE TABLE club_leader ( club_leader.club_id (INT), club_leader.member_id (INT), club_leader.year_join (TEXT), ) CREATE TABLE member ( member.member_id (INT), member.name (TEXT), member.nationality (TEXT), member.age (INT), ) Possible JOINs: club_leader.club_id = club.club_id club_leader.member_id = member.member_id
{ 'member': ['Member_ID', 'Name', 'Nationality', 'Age'], 'club': ['Club_ID', 'Overall_Ranking', 'Team_Leader', 'Club_Name'], 'club_leader': ['Club_ID', 'Member_ID', 'Year_Join'] }
{ 'club_leader': ['Club_ID', 'Member_ID'], 'member': ['Member_ID', 'Age'] }
TABLE club ( club.Club_ID (INT), club.Overall_Ranking (INT), club.Team_Leader (TEXT), club.Club_Name (TEXT), ) TABLE club_leader ( club_leader.Club_ID (INT), club_leader.Member_ID (INT), club_leader.Year_Join (TEXT), ) TABLE member ( member.Member_ID (INT), member.Name (TEXT), member.Nationality (TEXT), member.Age (INT), ) Possible JOINs: club_leader.Club_ID = club.Club_ID club_leader.Member_ID = member.Member_ID
TABLE club ( club.club_id (INT), club.overall_ranking (INT), club.team_leader (TEXT), club.club_name (TEXT), ) TABLE club_leader ( club_leader.club_id (INT), club_leader.member_id (INT), club_leader.year_join (TEXT), ) TABLE member ( member.member_id (INT), member.name (TEXT), member.nationality (TEXT), member.age (INT), ) Possible JOINs: club_leader.club_id = club.club_id club_leader.member_id = member.member_id
TABLE club ( club.club_id (INT), club.overall_ranking (INT), club.team_leader (TEXT), club.club_name (TEXT), ) TABLE club_leader ( club_leader.club_id (INT), club_leader.member_id (INT), club_leader.year_join (TEXT), ) TABLE member ( member.member_id (INT), member.name (TEXT), member.nationality (TEXT), member.age (INT), ) Possible JOINs: club_leader.club_id = club.club_id club_leader.member_id = member.member_id
vehicle_driver
CREATE TABLE driver ( "Driver_ID" INTEGER, "Name" TEXT, "Citizenship" TEXT, "Racing_Series" TEXT, PRIMARY KEY ("Driver_ID") ) CREATE TABLE vehicle ( "Vehicle_ID" INTEGER, "Model" TEXT, "Build_Year" TEXT, "Top_Speed" INTEGER, "Power" INTEGER, "Builder" TEXT, "Total_Production" TEXT, PRIMARY KEY ("Vehicle_ID") ) CREATE TABLE vehicle_driver ( "Driver_ID" INTEGER, "Vehicle_ID" INTEGER, PRIMARY KEY ("Driver_ID", "Vehicle_ID"), FOREIGN KEY("Driver_ID") REFERENCES driver ("Driver_ID"), FOREIGN KEY("Vehicle_ID") REFERENCES vehicle ("Vehicle_ID") )
Count the number of drivers who have raced in NASCAR.
easy
Table driver ( driver.Driver_ID (INT), driver.Name (TEXT), driver.Citizenship (TEXT), driver.Racing_Series (TEXT), ) Table vehicle ( vehicle.Vehicle_ID (INT), vehicle.Model (TEXT), vehicle.Build_Year (TEXT), vehicle.Top_Speed (INT), vehicle.Power (INT), vehicle.Builder (TEXT), vehicle.Total_Production (TEXT), ) Table vehicle_driver ( vehicle_driver.Driver_ID (INT), vehicle_driver.Vehicle_ID (INT), ) Possible JOINs: vehicle_driver.Driver_ID = driver.Driver_ID vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
SELECT count(*) FROM driver WHERE Racing_Series = 'NASCAR'
{ 'driver': ['driver_id', 'racing_series'] }
CREATE TABLE driver ( driver.Driver_ID (INT), driver.Name (TEXT), driver.Citizenship (TEXT), driver.Racing_Series (TEXT), ) CREATE TABLE vehicle ( vehicle.Vehicle_ID (INT), vehicle.Model (TEXT), vehicle.Build_Year (TEXT), vehicle.Top_Speed (INT), vehicle.Power (INT), vehicle.Builder (TEXT), vehicle.Total_Production (TEXT), ) CREATE TABLE vehicle_driver ( vehicle_driver.Driver_ID (INT), vehicle_driver.Vehicle_ID (INT), ) Possible JOINs: vehicle_driver.Driver_ID = driver.Driver_ID vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
Table driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) Table vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) Table vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
CREATE TABLE driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) CREATE TABLE vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) CREATE TABLE vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
Table driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) Table vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) Table vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
CREATE TABLE driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) CREATE TABLE vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) CREATE TABLE vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
{ 'vehicle': ['Vehicle_ID', 'Model', 'Build_Year', 'Top_Speed', 'Power', 'Builder', 'Total_Production'], 'driver': ['Driver_ID', 'Name', 'Citizenship', 'Racing_Series'], 'vehicle_driver': ['Driver_ID', 'Vehicle_ID'] }
{ 'driver': ['Driver_ID', 'Racing_Series'] }
TABLE driver ( driver.Driver_ID (INT), driver.Name (TEXT), driver.Citizenship (TEXT), driver.Racing_Series (TEXT), ) TABLE vehicle ( vehicle.Vehicle_ID (INT), vehicle.Model (TEXT), vehicle.Build_Year (TEXT), vehicle.Top_Speed (INT), vehicle.Power (INT), vehicle.Builder (TEXT), vehicle.Total_Production (TEXT), ) TABLE vehicle_driver ( vehicle_driver.Driver_ID (INT), vehicle_driver.Vehicle_ID (INT), ) Possible JOINs: vehicle_driver.Driver_ID = driver.Driver_ID vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
TABLE driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) TABLE vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) TABLE vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
TABLE driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) TABLE vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) TABLE vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
e_commerce
CREATE TABLE "Customer_Payment_Methods" ( customer_id INTEGER NOT NULL, payment_method_code VARCHAR(10) NOT NULL, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, gender_code VARCHAR(1) NOT NULL, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), address_line_1 VARCHAR(255), town_city VARCHAR(50), county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, invoice_status_code VARCHAR(10) NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, product_id INTEGER NOT NULL, order_id INTEGER NOT NULL, order_item_status_code VARCHAR(10) NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, date_order_placed DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, product_name VARCHAR(80), product_price DECIMAL(19, 4) DEFAULT 0, product_color VARCHAR(50), product_size VARCHAR(50), product_description VARCHAR(255), PRIMARY KEY (product_id) ) CREATE TABLE "Shipment_Items" ( shipment_id INTEGER NOT NULL, order_item_id INTEGER NOT NULL, PRIMARY KEY (shipment_id, order_item_id), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id), FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id) ) CREATE TABLE "Shipments" ( shipment_id INTEGER, order_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, PRIMARY KEY (shipment_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) )
How many products have been shipped?
easy
Table Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) Table Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) Table Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) Table Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) Table Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) Table Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
SELECT count(*) FROM Shipment_Items
{ 'shipment_items': ['shipment_id'] }
CREATE TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) CREATE TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) CREATE TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) CREATE TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
Table Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) Table Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) Table Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) Table Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) Table Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) Table Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
CREATE TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) CREATE TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) CREATE TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) CREATE TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
Table customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) Table customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) Table invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) Table orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) Table products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) Table shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) Table shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
CREATE TABLE customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) CREATE TABLE invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) CREATE TABLE products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) CREATE TABLE shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) CREATE TABLE shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
{ 'Products': ['product_id', 'parent_product_id', 'product_name', 'product_price', 'product_color', 'product_size', 'product_description'], 'Customers': ['customer_id', 'gender_code', 'customer_first_name', 'customer_middle_initial', 'customer_last_name', 'email_address', 'login_name', 'login_password', 'phone_number', 'address_line_1', 'town_city', 'county', 'country'], 'Customer_Payment_Methods': ['customer_id', 'payment_method_code'], 'Invoices': ['invoice_number', 'invoice_status_code', 'invoice_date'], 'Orders': ['order_id', 'customer_id', 'order_status_code', 'date_order_placed'], 'Order_Items': ['order_item_id', 'product_id', 'order_id', 'order_item_status_code'], 'Shipments': ['shipment_id', 'order_id', 'invoice_number', 'shipment_tracking_number', 'shipment_date'], 'Shipment_Items': ['shipment_id', 'order_item_id'] }
{ 'Shipment_Items': ['shipment_id'] }
TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
TABLE customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) TABLE customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) TABLE invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) TABLE orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) TABLE products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) TABLE shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) TABLE shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
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 codes and corresponding contents of all the boxes, ordered by their values?
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 code , CONTENTS FROM boxes ORDER BY value
{ 'boxes': ['code', 'contents', 'value'] }
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', 'Value'] }
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
advertising_agencies
CREATE TABLE "Agencies" ( agency_id INTEGER, agency_details VARCHAR(255) NOT NULL, PRIMARY KEY (agency_id) ) CREATE TABLE "Clients" ( client_id INTEGER, agency_id INTEGER NOT NULL, sic_code VARCHAR(10) NOT NULL, client_details VARCHAR(255) NOT NULL, PRIMARY KEY (client_id), FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id) ) CREATE TABLE "Invoices" ( invoice_id INTEGER, client_id INTEGER NOT NULL, invoice_status VARCHAR(10) NOT NULL, invoice_details VARCHAR(255) NOT NULL, PRIMARY KEY (invoice_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Meetings" ( meeting_id INTEGER, client_id INTEGER NOT NULL, meeting_outcome VARCHAR(10) NOT NULL, meeting_type VARCHAR(10) NOT NULL, billable_yn VARCHAR(1), start_date_time DATETIME, end_date_time DATETIME, purpose_of_meeting VARCHAR(255), other_details VARCHAR(255) NOT NULL, PRIMARY KEY (meeting_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Payments" ( payment_id INTEGER NOT NULL, invoice_id INTEGER NOT NULL, payment_details VARCHAR(255) NOT NULL, FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, agency_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_in_Meetings" ( meeting_id INTEGER NOT NULL, staff_id INTEGER NOT NULL, FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id) )
What are the client details for each client and the corresponding details of their agencies?
medium
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
SELECT Clients.client_details , Agencies.agency_details FROM Clients JOIN Agencies ON Clients.agency_id = Agencies.agency_id
{ 'clients': ['client_id', 'agency_id', 'client_details'], 'agencies': ['agency_id', 'agency_details'] }
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) Table clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) Table invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) Table meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) Table payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) Table staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) Table staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
CREATE TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) CREATE TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) CREATE TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) CREATE TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) CREATE TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) CREATE TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
{ 'Agencies': ['agency_id', 'agency_details'], 'Staff': ['staff_id', 'agency_id', 'staff_details'], 'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'], 'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'], 'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'], 'Payments': ['payment_id', 'invoice_id', 'payment_details'], 'Staff_in_Meetings': ['meeting_id', 'staff_id'] }
{ 'Clients': ['client_id', 'agency_id', 'client_details'], 'Agencies': ['agency_id', 'agency_details'] }
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
advertising_agencies
CREATE TABLE "Agencies" ( agency_id INTEGER, agency_details VARCHAR(255) NOT NULL, PRIMARY KEY (agency_id) ) CREATE TABLE "Clients" ( client_id INTEGER, agency_id INTEGER NOT NULL, sic_code VARCHAR(10) NOT NULL, client_details VARCHAR(255) NOT NULL, PRIMARY KEY (client_id), FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id) ) CREATE TABLE "Invoices" ( invoice_id INTEGER, client_id INTEGER NOT NULL, invoice_status VARCHAR(10) NOT NULL, invoice_details VARCHAR(255) NOT NULL, PRIMARY KEY (invoice_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Meetings" ( meeting_id INTEGER, client_id INTEGER NOT NULL, meeting_outcome VARCHAR(10) NOT NULL, meeting_type VARCHAR(10) NOT NULL, billable_yn VARCHAR(1), start_date_time DATETIME, end_date_time DATETIME, purpose_of_meeting VARCHAR(255), other_details VARCHAR(255) NOT NULL, PRIMARY KEY (meeting_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Payments" ( payment_id INTEGER NOT NULL, invoice_id INTEGER NOT NULL, payment_details VARCHAR(255) NOT NULL, FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, agency_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_in_Meetings" ( meeting_id INTEGER NOT NULL, staff_id INTEGER NOT NULL, FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id) )
Show all invoice ids and the number of payments for each invoice.
medium
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
SELECT invoice_id , count(*) FROM Payments GROUP BY invoice_id
{ 'payments': ['invoice_id'] }
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) Table clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) Table invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) Table meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) Table payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) Table staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) Table staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
CREATE TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) CREATE TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) CREATE TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) CREATE TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) CREATE TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) CREATE TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
{ 'Agencies': ['agency_id', 'agency_details'], 'Staff': ['staff_id', 'agency_id', 'staff_details'], 'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'], 'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'], 'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'], 'Payments': ['payment_id', 'invoice_id', 'payment_details'], 'Staff_in_Meetings': ['meeting_id', 'staff_id'] }
{ 'Payments': ['invoice_id'] }
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
sing_contest
CREATE TABLE participants ( id INTEGER, name TEXT, popularity REAL, PRIMARY KEY (id) ) CREATE TABLE performance_score ( participant_id INTEGER, songs_id INTEGER, voice_sound_quality REAL, rhythm_tempo REAL, stage_presence REAL, PRIMARY KEY (participant_id, songs_id), FOREIGN KEY(songs_id) REFERENCES songs (id), FOREIGN KEY(participant_id) REFERENCES participants (id) ) CREATE TABLE songs ( id INTEGER, language TEXT, original_artist TEXT, name TEXT, english_translation TEXT, PRIMARY KEY (id) )
What are the maximum and minimum voice sound quality score of the performances?
medium
Table participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) Table performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) Table songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
SELECT max(voice_sound_quality) , min(voice_sound_quality) FROM performance_score
{ 'performance_score': ['participant_id', 'voice_sound_quality'] }
CREATE TABLE participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) CREATE TABLE performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) CREATE TABLE songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
Table participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) Table performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) Table songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
CREATE TABLE participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) CREATE TABLE performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) CREATE TABLE songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
Table participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) Table performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) Table songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
CREATE TABLE participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) CREATE TABLE performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) CREATE TABLE songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
{ 'participants': ['id', 'name', 'popularity'], 'songs': ['id', 'language', 'original_artist', 'name', 'english_translation'], 'performance_score': ['participant_id', 'songs_id', 'voice_sound_quality', 'rhythm_tempo', 'stage_presence'] }
{ 'performance_score': ['participant_id', 'voice_sound_quality'] }
TABLE participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) TABLE performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) TABLE songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
TABLE participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) TABLE performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) TABLE songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
TABLE participants ( participants.id (INT), participants.name (TEXT), participants.popularity (REAL), ) TABLE performance_score ( performance_score.participant_id (INT), performance_score.songs_id (INT), performance_score.voice_sound_quality (REAL), performance_score.rhythm_tempo (REAL), performance_score.stage_presence (REAL), ) TABLE songs ( songs.id (INT), songs.language (TEXT), songs.original_artist (TEXT), songs.name (TEXT), songs.english_translation (TEXT), ) Possible JOINs: performance_score.participant_id = participants.id performance_score.songs_id = songs.id
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") )
For each warehouse location, what is the value of the most expensive box?
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 max(boxes.value) , warehouses.location FROM boxes JOIN warehouses ON boxes.warehouse = warehouses.code GROUP BY warehouses.location
{ 'boxes': ['code', 'value', 'warehouse'], 'warehouses': ['code', 'location'] }
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', 'Value', 'Warehouse'], 'Warehouses': ['Code', 'Location'] }
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
pilot_1
CREATE TABLE "Hangar" ( plane_name CHAR(15) NOT NULL, location CHAR(15), PRIMARY KEY (plane_name) ) CREATE TABLE "PilotSkills" ( pilot_name CHAR(15) NOT NULL, plane_name CHAR(15) NOT NULL, age INTEGER, PRIMARY KEY (pilot_name, plane_name), FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name) )
Find all information of on pilots whose age is less than 30.
easy
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
SELECT * FROM PilotSkills WHERE age < 30
{ 'pilotskills': ['pilot_name', 'age'] }
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) Table pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
CREATE TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) CREATE TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
{ 'PilotSkills': ['pilot_name', 'plane_name', 'age'], 'Hangar': ['plane_name', 'location'] }
{ 'PilotSkills': ['pilot_name', 'age'] }
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
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) )
Which property had the lowest price requested by the vendor? List the id and the price.
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 property_id , vendor_requested_price FROM Properties ORDER BY vendor_requested_price LIMIT 1;
{ 'properties': ['property_id', 'vendor_requested_price'] }
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'] }
{ 'Properties': ['property_id', 'vendor_requested_price'] }
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
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 */
Which students have a student loan more than the average amount? List the students' biographical data and the details.
extra
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 Students.bio_data , Students.student_details FROM Students JOIN Student_Loans ON Students.student_id = Student_Loans.student_id WHERE Student_Loans.amount_of_loan > ( SELECT avg(amount_of_loan) FROM Student_Loans )
{ 'students': ['student_id', 'bio_data', 'student_details'], 'student_loans': ['student_loan_id', 'student_id', 'amount_of_loan'] }
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'] }
{ 'Students': ['student_id', 'bio_data', 'student_details'], 'Student_Loans': ['student_loan_id', 'student_id', 'amount_of_loan'] }
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
online_exams
CREATE TABLE "Exams" ( "Exam_ID" INTEGER NOT NULL, "Subject_Code" CHAR(15) NOT NULL, "Exam_Date" DATETIME, "Exam_Name" VARCHAR(255), PRIMARY KEY ("Exam_ID") ) CREATE TABLE "Questions" ( "Question_ID" INTEGER NOT NULL, "Type_of_Question_Code" VARCHAR(15) NOT NULL, "Question_Text" VARCHAR(255), PRIMARY KEY ("Question_ID") ) CREATE TABLE "Questions_in_Exams" ( "Exam_ID" INTEGER NOT NULL, "Question_ID" INTEGER NOT NULL, PRIMARY KEY ("Exam_ID", "Question_ID"), FOREIGN KEY("Question_ID") REFERENCES "Questions" ("Question_ID"), FOREIGN KEY("Exam_ID") REFERENCES "Exams" ("Exam_ID") ) CREATE TABLE "Student_Answers" ( "Student_Answer_ID" INTEGER NOT NULL, "Exam_ID" INTEGER NOT NULL, "Question_ID" INTEGER NOT NULL, "Student_ID" INTEGER NOT NULL, "Date_of_Answer" DATETIME, "Comments" VARCHAR(255), "Satisfactory_YN" VARCHAR(1), "Student_Answer_Text" VARCHAR(255), PRIMARY KEY ("Student_Answer_ID"), FOREIGN KEY("Student_ID") REFERENCES "Students" ("Student_ID"), FOREIGN KEY("Exam_ID", "Question_ID") REFERENCES "Questions_in_Exams" ("Exam_ID", "Question_ID") ) CREATE TABLE "Student_Assessments" ( "Student_Answer_ID" VARCHAR(100) NOT NULL, "Valid_Answer_ID" INTEGER NOT NULL, "Student_Answer_Text" VARCHAR(255), "Satisfactory_YN" CHAR(1), "Assessment" VARCHAR(40), PRIMARY KEY ("Student_Answer_ID"), FOREIGN KEY("Valid_Answer_ID") REFERENCES "Valid_Answers" ("Valid_Answer_ID") ) CREATE TABLE "Students" ( "Student_ID" INTEGER NOT NULL, "First_Name" VARCHAR(255), "Middle_Name" VARCHAR(255), "Last_Name" VARCHAR(255), "Gender_MFU" CHAR(1), "Student_Address" VARCHAR(255), "Email_Adress" VARCHAR(255), "Cell_Mobile_Phone" VARCHAR(255), "Home_Phone" VARCHAR(255), PRIMARY KEY ("Student_ID") ) CREATE TABLE "Valid_Answers" ( "Valid_Answer_ID" INTEGER NOT NULL, "Question_ID" INTEGER NOT NULL, "Valid_Answer_Text" VARCHAR(255), PRIMARY KEY ("Valid_Answer_ID"), FOREIGN KEY("Question_ID") REFERENCES "Questions" ("Question_ID") )
What is the most common valid answer text?
hard
Table Exams ( Exams.Exam_ID (INTEGER), Exams.Subject_Code (CHAR(15)), Exams.Exam_Date (DATETIME), Exams.Exam_Name (VARCHAR(255)), ) Table Questions ( Questions.Question_ID (INTEGER), Questions.Type_of_Question_Code (VARCHAR(15)), Questions.Question_Text (VARCHAR(255)), ) Table Questions_in_Exams ( Questions_in_Exams.Exam_ID (INTEGER), Questions_in_Exams.Question_ID (INTEGER), ) Table Student_Answers ( Student_Answers.Student_Answer_ID (INTEGER), Student_Answers.Exam_ID (INTEGER), Student_Answers.Question_ID (INTEGER), Student_Answers.Student_ID (INTEGER), Student_Answers.Date_of_Answer (DATETIME), Student_Answers.Comments (VARCHAR(255)), Student_Answers.Satisfactory_YN (VARCHAR(1)), Student_Answers.Student_Answer_Text (VARCHAR(255)), ) Table Student_Assessments ( Student_Assessments.Student_Answer_ID (VARCHAR(100)), Student_Assessments.Valid_Answer_ID (INTEGER), Student_Assessments.Student_Answer_Text (VARCHAR(255)), Student_Assessments.Satisfactory_YN (CHAR(1)), Student_Assessments.Assessment (VARCHAR(40)), ) Table Students ( Students.Student_ID (INTEGER), Students.First_Name (VARCHAR(255)), Students.Middle_Name (VARCHAR(255)), Students.Last_Name (VARCHAR(255)), Students.Gender_MFU (CHAR(1)), Students.Student_Address (VARCHAR(255)), Students.Email_Adress (VARCHAR(255)), Students.Cell_Mobile_Phone (VARCHAR(255)), Students.Home_Phone (VARCHAR(255)), ) Table Valid_Answers ( Valid_Answers.Valid_Answer_ID (INTEGER), Valid_Answers.Question_ID (INTEGER), Valid_Answers.Valid_Answer_Text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.Exam_ID = Exams.Exam_ID Questions_in_Exams.Question_ID = Questions.Question_ID Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID Student_Answers.Question_ID = Questions_in_Exams.Question_ID Student_Answers.Student_ID = Students.Student_ID Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID Valid_Answers.Question_ID = Questions.Question_ID
SELECT Valid_Answer_Text FROM Valid_Answers GROUP BY Valid_Answer_Text ORDER BY COUNT(*) DESC LIMIT 1
{ 'valid_answers': ['valid_answer_id', 'valid_answer_text'] }
CREATE TABLE Exams ( Exams.Exam_ID (INTEGER), Exams.Subject_Code (CHAR(15)), Exams.Exam_Date (DATETIME), Exams.Exam_Name (VARCHAR(255)), ) CREATE TABLE Questions ( Questions.Question_ID (INTEGER), Questions.Type_of_Question_Code (VARCHAR(15)), Questions.Question_Text (VARCHAR(255)), ) CREATE TABLE Questions_in_Exams ( Questions_in_Exams.Exam_ID (INTEGER), Questions_in_Exams.Question_ID (INTEGER), ) CREATE TABLE Student_Answers ( Student_Answers.Student_Answer_ID (INTEGER), Student_Answers.Exam_ID (INTEGER), Student_Answers.Question_ID (INTEGER), Student_Answers.Student_ID (INTEGER), Student_Answers.Date_of_Answer (DATETIME), Student_Answers.Comments (VARCHAR(255)), Student_Answers.Satisfactory_YN (VARCHAR(1)), Student_Answers.Student_Answer_Text (VARCHAR(255)), ) CREATE TABLE Student_Assessments ( Student_Assessments.Student_Answer_ID (VARCHAR(100)), Student_Assessments.Valid_Answer_ID (INTEGER), Student_Assessments.Student_Answer_Text (VARCHAR(255)), Student_Assessments.Satisfactory_YN (CHAR(1)), Student_Assessments.Assessment (VARCHAR(40)), ) CREATE TABLE Students ( Students.Student_ID (INTEGER), Students.First_Name (VARCHAR(255)), Students.Middle_Name (VARCHAR(255)), Students.Last_Name (VARCHAR(255)), Students.Gender_MFU (CHAR(1)), Students.Student_Address (VARCHAR(255)), Students.Email_Adress (VARCHAR(255)), Students.Cell_Mobile_Phone (VARCHAR(255)), Students.Home_Phone (VARCHAR(255)), ) CREATE TABLE Valid_Answers ( Valid_Answers.Valid_Answer_ID (INTEGER), Valid_Answers.Question_ID (INTEGER), Valid_Answers.Valid_Answer_Text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.Exam_ID = Exams.Exam_ID Questions_in_Exams.Question_ID = Questions.Question_ID Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID Student_Answers.Question_ID = Questions_in_Exams.Question_ID Student_Answers.Student_ID = Students.Student_ID Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID Valid_Answers.Question_ID = Questions.Question_ID
Table Exams ( Exams.exam_id (INTEGER), Exams.subject_code (CHAR(15)), Exams.exam_date (DATETIME), Exams.exam_name (VARCHAR(255)), ) Table Questions ( Questions.question_id (INTEGER), Questions.type_of_question_code (VARCHAR(15)), Questions.question_text (VARCHAR(255)), ) Table Questions_in_Exams ( Questions_in_Exams.exam_id (INTEGER), Questions_in_Exams.question_id (INTEGER), ) Table Student_Answers ( Student_Answers.student_answer_id (INTEGER), Student_Answers.exam_id (INTEGER), Student_Answers.question_id (INTEGER), Student_Answers.student_id (INTEGER), Student_Answers.date_of_answer (DATETIME), Student_Answers.comments (VARCHAR(255)), Student_Answers.satisfactory_yn (VARCHAR(1)), Student_Answers.student_answer_text (VARCHAR(255)), ) Table Student_Assessments ( Student_Assessments.student_answer_id (VARCHAR(100)), Student_Assessments.valid_answer_id (INTEGER), Student_Assessments.student_answer_text (VARCHAR(255)), Student_Assessments.satisfactory_yn (CHAR(1)), Student_Assessments.assessment (VARCHAR(40)), ) Table Students ( Students.student_id (INTEGER), Students.first_name (VARCHAR(255)), Students.middle_name (VARCHAR(255)), Students.last_name (VARCHAR(255)), Students.gender_mfu (CHAR(1)), Students.student_address (VARCHAR(255)), Students.email_adress (VARCHAR(255)), Students.cell_mobile_phone (VARCHAR(255)), Students.home_phone (VARCHAR(255)), ) Table Valid_Answers ( Valid_Answers.valid_answer_id (INTEGER), Valid_Answers.question_id (INTEGER), Valid_Answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.exam_id = Exams.exam_id Questions_in_Exams.question_id = Questions.question_id Student_Answers.exam_id = Questions_in_Exams.exam_id Student_Answers.question_id = Questions_in_Exams.question_id Student_Answers.student_id = Students.student_id Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id Valid_Answers.question_id = Questions.question_id
CREATE TABLE Exams ( Exams.exam_id (INTEGER), Exams.subject_code (CHAR(15)), Exams.exam_date (DATETIME), Exams.exam_name (VARCHAR(255)), ) CREATE TABLE Questions ( Questions.question_id (INTEGER), Questions.type_of_question_code (VARCHAR(15)), Questions.question_text (VARCHAR(255)), ) CREATE TABLE Questions_in_Exams ( Questions_in_Exams.exam_id (INTEGER), Questions_in_Exams.question_id (INTEGER), ) CREATE TABLE Student_Answers ( Student_Answers.student_answer_id (INTEGER), Student_Answers.exam_id (INTEGER), Student_Answers.question_id (INTEGER), Student_Answers.student_id (INTEGER), Student_Answers.date_of_answer (DATETIME), Student_Answers.comments (VARCHAR(255)), Student_Answers.satisfactory_yn (VARCHAR(1)), Student_Answers.student_answer_text (VARCHAR(255)), ) CREATE TABLE Student_Assessments ( Student_Assessments.student_answer_id (VARCHAR(100)), Student_Assessments.valid_answer_id (INTEGER), Student_Assessments.student_answer_text (VARCHAR(255)), Student_Assessments.satisfactory_yn (CHAR(1)), Student_Assessments.assessment (VARCHAR(40)), ) CREATE TABLE Students ( Students.student_id (INTEGER), Students.first_name (VARCHAR(255)), Students.middle_name (VARCHAR(255)), Students.last_name (VARCHAR(255)), Students.gender_mfu (CHAR(1)), Students.student_address (VARCHAR(255)), Students.email_adress (VARCHAR(255)), Students.cell_mobile_phone (VARCHAR(255)), Students.home_phone (VARCHAR(255)), ) CREATE TABLE Valid_Answers ( Valid_Answers.valid_answer_id (INTEGER), Valid_Answers.question_id (INTEGER), Valid_Answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.exam_id = Exams.exam_id Questions_in_Exams.question_id = Questions.question_id Student_Answers.exam_id = Questions_in_Exams.exam_id Student_Answers.question_id = Questions_in_Exams.question_id Student_Answers.student_id = Students.student_id Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id Valid_Answers.question_id = Questions.question_id
Table exams ( exams.exam_id (INTEGER), exams.subject_code (CHAR(15)), exams.exam_date (DATETIME), exams.exam_name (VARCHAR(255)), ) Table questions ( questions.question_id (INTEGER), questions.type_of_question_code (VARCHAR(15)), questions.question_text (VARCHAR(255)), ) Table questions_in_exams ( questions_in_exams.exam_id (INTEGER), questions_in_exams.question_id (INTEGER), ) Table student_answers ( student_answers.student_answer_id (INTEGER), student_answers.exam_id (INTEGER), student_answers.question_id (INTEGER), student_answers.student_id (INTEGER), student_answers.date_of_answer (DATETIME), student_answers.comments (VARCHAR(255)), student_answers.satisfactory_yn (VARCHAR(1)), student_answers.student_answer_text (VARCHAR(255)), ) Table student_assessments ( student_assessments.student_answer_id (VARCHAR(100)), student_assessments.valid_answer_id (INTEGER), student_assessments.student_answer_text (VARCHAR(255)), student_assessments.satisfactory_yn (CHAR(1)), student_assessments.assessment (VARCHAR(40)), ) Table students ( students.student_id (INTEGER), students.first_name (VARCHAR(255)), students.middle_name (VARCHAR(255)), students.last_name (VARCHAR(255)), students.gender_mfu (CHAR(1)), students.student_address (VARCHAR(255)), students.email_adress (VARCHAR(255)), students.cell_mobile_phone (VARCHAR(255)), students.home_phone (VARCHAR(255)), ) Table valid_answers ( valid_answers.valid_answer_id (INTEGER), valid_answers.question_id (INTEGER), valid_answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: questions_in_exams.exam_id = exams.exam_id questions_in_exams.question_id = questions.question_id student_answers.exam_id = questions_in_exams.exam_id student_answers.question_id = questions_in_exams.question_id student_answers.student_id = students.student_id student_assessments.valid_answer_id = valid_answers.valid_answer_id valid_answers.question_id = questions.question_id
CREATE TABLE exams ( exams.exam_id (INTEGER), exams.subject_code (CHAR(15)), exams.exam_date (DATETIME), exams.exam_name (VARCHAR(255)), ) CREATE TABLE questions ( questions.question_id (INTEGER), questions.type_of_question_code (VARCHAR(15)), questions.question_text (VARCHAR(255)), ) CREATE TABLE questions_in_exams ( questions_in_exams.exam_id (INTEGER), questions_in_exams.question_id (INTEGER), ) CREATE TABLE student_answers ( student_answers.student_answer_id (INTEGER), student_answers.exam_id (INTEGER), student_answers.question_id (INTEGER), student_answers.student_id (INTEGER), student_answers.date_of_answer (DATETIME), student_answers.comments (VARCHAR(255)), student_answers.satisfactory_yn (VARCHAR(1)), student_answers.student_answer_text (VARCHAR(255)), ) CREATE TABLE student_assessments ( student_assessments.student_answer_id (VARCHAR(100)), student_assessments.valid_answer_id (INTEGER), student_assessments.student_answer_text (VARCHAR(255)), student_assessments.satisfactory_yn (CHAR(1)), student_assessments.assessment (VARCHAR(40)), ) CREATE TABLE students ( students.student_id (INTEGER), students.first_name (VARCHAR(255)), students.middle_name (VARCHAR(255)), students.last_name (VARCHAR(255)), students.gender_mfu (CHAR(1)), students.student_address (VARCHAR(255)), students.email_adress (VARCHAR(255)), students.cell_mobile_phone (VARCHAR(255)), students.home_phone (VARCHAR(255)), ) CREATE TABLE valid_answers ( valid_answers.valid_answer_id (INTEGER), valid_answers.question_id (INTEGER), valid_answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: questions_in_exams.exam_id = exams.exam_id questions_in_exams.question_id = questions.question_id student_answers.exam_id = questions_in_exams.exam_id student_answers.question_id = questions_in_exams.question_id student_answers.student_id = students.student_id student_assessments.valid_answer_id = valid_answers.valid_answer_id valid_answers.question_id = questions.question_id
{ 'Students': ['Student_ID', 'First_Name', 'Middle_Name', 'Last_Name', 'Gender_MFU', 'Student_Address', 'Email_Adress', 'Cell_Mobile_Phone', 'Home_Phone'], 'Questions': ['Question_ID', 'Type_of_Question_Code', 'Question_Text'], 'Exams': ['Exam_ID', 'Subject_Code', 'Exam_Date', 'Exam_Name'], 'Questions_in_Exams': ['Exam_ID', 'Question_ID'], 'Valid_Answers': ['Valid_Answer_ID', 'Question_ID', 'Valid_Answer_Text'], 'Student_Answers': ['Student_Answer_ID', 'Exam_ID', 'Question_ID', 'Student_ID', 'Date_of_Answer', 'Comments', 'Satisfactory_YN', 'Student_Answer_Text'], 'Student_Assessments': ['Student_Answer_ID', 'Valid_Answer_ID', 'Student_Answer_Text', 'Satisfactory_YN', 'Assessment'] }
{ 'Valid_Answers': ['Valid_Answer_ID', 'Valid_Answer_Text'] }
TABLE Exams ( Exams.Exam_ID (INTEGER), Exams.Subject_Code (CHAR(15)), Exams.Exam_Date (DATETIME), Exams.Exam_Name (VARCHAR(255)), ) TABLE Questions ( Questions.Question_ID (INTEGER), Questions.Type_of_Question_Code (VARCHAR(15)), Questions.Question_Text (VARCHAR(255)), ) TABLE Questions_in_Exams ( Questions_in_Exams.Exam_ID (INTEGER), Questions_in_Exams.Question_ID (INTEGER), ) TABLE Student_Answers ( Student_Answers.Student_Answer_ID (INTEGER), Student_Answers.Exam_ID (INTEGER), Student_Answers.Question_ID (INTEGER), Student_Answers.Student_ID (INTEGER), Student_Answers.Date_of_Answer (DATETIME), Student_Answers.Comments (VARCHAR(255)), Student_Answers.Satisfactory_YN (VARCHAR(1)), Student_Answers.Student_Answer_Text (VARCHAR(255)), ) TABLE Student_Assessments ( Student_Assessments.Student_Answer_ID (VARCHAR(100)), Student_Assessments.Valid_Answer_ID (INTEGER), Student_Assessments.Student_Answer_Text (VARCHAR(255)), Student_Assessments.Satisfactory_YN (CHAR(1)), Student_Assessments.Assessment (VARCHAR(40)), ) TABLE Students ( Students.Student_ID (INTEGER), Students.First_Name (VARCHAR(255)), Students.Middle_Name (VARCHAR(255)), Students.Last_Name (VARCHAR(255)), Students.Gender_MFU (CHAR(1)), Students.Student_Address (VARCHAR(255)), Students.Email_Adress (VARCHAR(255)), Students.Cell_Mobile_Phone (VARCHAR(255)), Students.Home_Phone (VARCHAR(255)), ) TABLE Valid_Answers ( Valid_Answers.Valid_Answer_ID (INTEGER), Valid_Answers.Question_ID (INTEGER), Valid_Answers.Valid_Answer_Text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.Exam_ID = Exams.Exam_ID Questions_in_Exams.Question_ID = Questions.Question_ID Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID Student_Answers.Question_ID = Questions_in_Exams.Question_ID Student_Answers.Student_ID = Students.Student_ID Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID Valid_Answers.Question_ID = Questions.Question_ID
TABLE Exams ( Exams.exam_id (INTEGER), Exams.subject_code (CHAR(15)), Exams.exam_date (DATETIME), Exams.exam_name (VARCHAR(255)), ) TABLE Questions ( Questions.question_id (INTEGER), Questions.type_of_question_code (VARCHAR(15)), Questions.question_text (VARCHAR(255)), ) TABLE Questions_in_Exams ( Questions_in_Exams.exam_id (INTEGER), Questions_in_Exams.question_id (INTEGER), ) TABLE Student_Answers ( Student_Answers.student_answer_id (INTEGER), Student_Answers.exam_id (INTEGER), Student_Answers.question_id (INTEGER), Student_Answers.student_id (INTEGER), Student_Answers.date_of_answer (DATETIME), Student_Answers.comments (VARCHAR(255)), Student_Answers.satisfactory_yn (VARCHAR(1)), Student_Answers.student_answer_text (VARCHAR(255)), ) TABLE Student_Assessments ( Student_Assessments.student_answer_id (VARCHAR(100)), Student_Assessments.valid_answer_id (INTEGER), Student_Assessments.student_answer_text (VARCHAR(255)), Student_Assessments.satisfactory_yn (CHAR(1)), Student_Assessments.assessment (VARCHAR(40)), ) TABLE Students ( Students.student_id (INTEGER), Students.first_name (VARCHAR(255)), Students.middle_name (VARCHAR(255)), Students.last_name (VARCHAR(255)), Students.gender_mfu (CHAR(1)), Students.student_address (VARCHAR(255)), Students.email_adress (VARCHAR(255)), Students.cell_mobile_phone (VARCHAR(255)), Students.home_phone (VARCHAR(255)), ) TABLE Valid_Answers ( Valid_Answers.valid_answer_id (INTEGER), Valid_Answers.question_id (INTEGER), Valid_Answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.exam_id = Exams.exam_id Questions_in_Exams.question_id = Questions.question_id Student_Answers.exam_id = Questions_in_Exams.exam_id Student_Answers.question_id = Questions_in_Exams.question_id Student_Answers.student_id = Students.student_id Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id Valid_Answers.question_id = Questions.question_id
TABLE exams ( exams.exam_id (INTEGER), exams.subject_code (CHAR(15)), exams.exam_date (DATETIME), exams.exam_name (VARCHAR(255)), ) TABLE questions ( questions.question_id (INTEGER), questions.type_of_question_code (VARCHAR(15)), questions.question_text (VARCHAR(255)), ) TABLE questions_in_exams ( questions_in_exams.exam_id (INTEGER), questions_in_exams.question_id (INTEGER), ) TABLE student_answers ( student_answers.student_answer_id (INTEGER), student_answers.exam_id (INTEGER), student_answers.question_id (INTEGER), student_answers.student_id (INTEGER), student_answers.date_of_answer (DATETIME), student_answers.comments (VARCHAR(255)), student_answers.satisfactory_yn (VARCHAR(1)), student_answers.student_answer_text (VARCHAR(255)), ) TABLE student_assessments ( student_assessments.student_answer_id (VARCHAR(100)), student_assessments.valid_answer_id (INTEGER), student_assessments.student_answer_text (VARCHAR(255)), student_assessments.satisfactory_yn (CHAR(1)), student_assessments.assessment (VARCHAR(40)), ) TABLE students ( students.student_id (INTEGER), students.first_name (VARCHAR(255)), students.middle_name (VARCHAR(255)), students.last_name (VARCHAR(255)), students.gender_mfu (CHAR(1)), students.student_address (VARCHAR(255)), students.email_adress (VARCHAR(255)), students.cell_mobile_phone (VARCHAR(255)), students.home_phone (VARCHAR(255)), ) TABLE valid_answers ( valid_answers.valid_answer_id (INTEGER), valid_answers.question_id (INTEGER), valid_answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: questions_in_exams.exam_id = exams.exam_id questions_in_exams.question_id = questions.question_id student_answers.exam_id = questions_in_exams.exam_id student_answers.question_id = questions_in_exams.question_id student_answers.student_id = students.student_id student_assessments.valid_answer_id = valid_answers.valid_answer_id valid_answers.question_id = questions.question_id
district_spokesman
CREATE TABLE district ( "District_ID" INTEGER, "Name" TEXT, "Area_km" REAL, "Population" REAL, "Density_km" REAL, "Government_website" TEXT, PRIMARY KEY ("District_ID") ) CREATE TABLE spokesman ( "Spokesman_ID" INTEGER, "Name" TEXT, "Age" INTEGER, "Speach_title" TEXT, "Rank_position" REAL, "Points" REAL, PRIMARY KEY ("Spokesman_ID") ) CREATE TABLE spokesman_district ( "Spokesman_ID" INTEGER, "District_ID" INTEGER, "Start_year" TEXT, PRIMARY KEY ("Spokesman_ID"), FOREIGN KEY("Spokesman_ID") REFERENCES spokesman ("Spokesman_ID"), FOREIGN KEY("District_ID") REFERENCES district ("District_ID") )
Find the names and populations of the districts whose area is greater than the average area.
extra
Table district ( district.District_ID (INT), district.Name (TEXT), district.Area_km (REAL), district.Population (REAL), district.Density_km (REAL), district.Government_website (TEXT), ) Table spokesman ( spokesman.Spokesman_ID (INT), spokesman.Name (TEXT), spokesman.Age (INT), spokesman.Speach_title (TEXT), spokesman.Rank_position (REAL), spokesman.Points (REAL), ) Table spokesman_district ( spokesman_district.Spokesman_ID (INT), spokesman_district.District_ID (INT), spokesman_district.Start_year (TEXT), ) Possible JOINs: spokesman_district.Spokesman_ID = spokesman.Spokesman_ID spokesman_district.District_ID = district.District_ID
SELECT name , population FROM district WHERE area_km > (SELECT avg(area_km) FROM district)
{ 'district': ['district_id', 'name', 'area_km', 'population'] }
CREATE TABLE district ( district.District_ID (INT), district.Name (TEXT), district.Area_km (REAL), district.Population (REAL), district.Density_km (REAL), district.Government_website (TEXT), ) CREATE TABLE spokesman ( spokesman.Spokesman_ID (INT), spokesman.Name (TEXT), spokesman.Age (INT), spokesman.Speach_title (TEXT), spokesman.Rank_position (REAL), spokesman.Points (REAL), ) CREATE TABLE spokesman_district ( spokesman_district.Spokesman_ID (INT), spokesman_district.District_ID (INT), spokesman_district.Start_year (TEXT), ) Possible JOINs: spokesman_district.Spokesman_ID = spokesman.Spokesman_ID spokesman_district.District_ID = district.District_ID
Table district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) Table spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) Table spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
CREATE TABLE district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) CREATE TABLE spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) CREATE TABLE spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
Table district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) Table spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) Table spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
CREATE TABLE district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) CREATE TABLE spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) CREATE TABLE spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
{ 'district': ['District_ID', 'Name', 'Area_km', 'Population', 'Density_km', 'Government_website'], 'spokesman': ['Spokesman_ID', 'Name', 'Age', 'Speach_title', 'Rank_position', 'Points'], 'spokesman_district': ['Spokesman_ID', 'District_ID', 'Start_year'] }
{ 'district': ['District_ID', 'Name', 'Area_km', 'Population'] }
TABLE district ( district.District_ID (INT), district.Name (TEXT), district.Area_km (REAL), district.Population (REAL), district.Density_km (REAL), district.Government_website (TEXT), ) TABLE spokesman ( spokesman.Spokesman_ID (INT), spokesman.Name (TEXT), spokesman.Age (INT), spokesman.Speach_title (TEXT), spokesman.Rank_position (REAL), spokesman.Points (REAL), ) TABLE spokesman_district ( spokesman_district.Spokesman_ID (INT), spokesman_district.District_ID (INT), spokesman_district.Start_year (TEXT), ) Possible JOINs: spokesman_district.Spokesman_ID = spokesman.Spokesman_ID spokesman_district.District_ID = district.District_ID
TABLE district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) TABLE spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) TABLE spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
TABLE district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) TABLE spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) TABLE spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_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") )
Find the name of theaters that has at least one movie playing.
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 name FROM movietheaters GROUP BY name HAVING count(*) >= 1
{ 'movietheaters': ['code', 'name'] }
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'] }
{ 'MovieTheaters': ['Code', 'Name'] }
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
cre_Doc_and_collections
CREATE TABLE "Collection_Subset_Members" ( "Collection_ID" INTEGER NOT NULL, "Related_Collection_ID" INTEGER NOT NULL, "Collection_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Collection_ID", "Related_Collection_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Related_Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Collection_Subset_ID") REFERENCES "Collection_Subsets" ("Collection_Subset_ID") ) CREATE TABLE "Collection_Subsets" ( "Collection_Subset_ID" INTEGER NOT NULL, "Collection_Subset_Name" VARCHAR(255) NOT NULL, "Collecrtion_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Collection_Subset_ID") ) CREATE TABLE "Collections" ( "Collection_ID" INTEGER NOT NULL, "Parent_Collection_ID" INTEGER, "Collection_Name" VARCHAR(255), "Collection_Description" VARCHAR(255), PRIMARY KEY ("Collection_ID") ) CREATE TABLE "Document_Objects" ( "Document_Object_ID" INTEGER NOT NULL, "Parent_Document_Object_ID" INTEGER, "Owner" VARCHAR(255), "Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_Object_ID") ) CREATE TABLE "Document_Subset_Members" ( "Document_Object_ID" INTEGER NOT NULL, "Related_Document_Object_ID" INTEGER NOT NULL, "Document_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Related_Document_Object_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Document_Subset_ID") REFERENCES "Document_Subsets" ("Document_Subset_ID"), FOREIGN KEY("Related_Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID") ) CREATE TABLE "Document_Subsets" ( "Document_Subset_ID" INTEGER NOT NULL, "Document_Subset_Name" VARCHAR(255) NOT NULL, "Document_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Subset_ID") ) CREATE TABLE "Documents_in_Collections" ( "Document_Object_ID" INTEGER NOT NULL, "Collection_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Collection_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID") )
List collection subset id, name and number of collections in each subset.
medium
Table Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) Table Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) Table Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
SELECT Collection_Subset_Members.Collection_Subset_ID , Collection_Subsets.Collection_Subset_Name , count(*) FROM Collection_Subsets JOIN Collection_Subset_Members ON Collection_Subsets.Collection_Subset_ID = Collection_Subset_Members.Collection_Subset_ID GROUP BY Collection_Subset_Members.Collection_Subset_ID;
{ 'collection_subsets': ['collection_subset_id', 'collection_subset_name'], 'collection_subset_members': ['collection_id', 'collection_subset_id'] }
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
Table Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) Table Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) Table Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
Table collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) Table collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) Table collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) Table document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) Table document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) Table document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) Table documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
CREATE TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) CREATE TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) CREATE TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) CREATE TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) CREATE TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
{ 'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name', 'Document_Subset_Details'], 'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name', 'Collecrtion_Subset_Details'], 'Document_Objects': ['Document_Object_ID', 'Parent_Document_Object_ID', 'Owner', 'Description', 'Other_Details'], 'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name', 'Collection_Description'], 'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'], 'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'], 'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID', 'Collection_Subset_ID'] }
{ 'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name'], 'Collection_Subset_Members': ['Collection_ID', 'Collection_Subset_ID'] }
TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_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") )
Find the title of the movie that is played in the Odeon theater.
medium
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 movies.title FROM movies JOIN movietheaters ON movies.code = movietheaters.movie WHERE movietheaters.name = 'Odeon'
{ 'movies': ['code', 'title'], 'movietheaters': ['code', 'name', 'movie'] }
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'], 'MovieTheaters': ['Code', 'Name', 'Movie'] }
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
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") )
When did each artist who created less than 4 paintings die ?
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 artists.deathyear FROM artists JOIN paintings ON artists.artistid = paintings.painterid GROUP BY paintings.painterid HAVING count(*) < 4
{ 'artists': ['artistid', 'deathyear'], 'paintings': ['paintingid', 'painterid'] }
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', 'deathYear'], 'Paintings': ['paintingID', 'painterID'] }
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
bbc_channels
CREATE TABLE channel ( "Channel_ID" INTEGER, "Name" TEXT, "Analogue_terrestrial_channel" TEXT, "Digital_terrestrial_channel" TEXT, "Internet" TEXT, PRIMARY KEY ("Channel_ID") ) CREATE TABLE director ( "Director_ID" INTEGER, "Name" TEXT, "Age" INTEGER, PRIMARY KEY ("Director_ID") ) CREATE TABLE director_admin ( "Director_ID" INTEGER, "Channel_ID" INTEGER, "Is_first_director" BOOLEAN, PRIMARY KEY ("Director_ID", "Channel_ID"), FOREIGN KEY("Director_ID") REFERENCES director ("Director_ID"), FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID") ) CREATE TABLE program ( "Program_ID" INTEGER, "Start_Year" REAL, "Title" TEXT, "Director_ID" INTEGER, "Channel_ID" INTEGER, PRIMARY KEY ("Program_ID"), FOREIGN KEY("Director_ID") REFERENCES director ("Director_ID"), FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID") )
Find the name and age of the director who is in charge of the most programs?
extra
Table channel ( channel.Channel_ID (INT), channel.Name (TEXT), channel.Analogue_terrestrial_channel (TEXT), channel.Digital_terrestrial_channel (TEXT), channel.Internet (TEXT), ) Table director ( director.Director_ID (INT), director.Name (TEXT), director.Age (INT), ) Table director_admin ( director_admin.Director_ID (INT), director_admin.Channel_ID (INT), director_admin.Is_first_director (bool), ) Table program ( program.Program_ID (INT), program.Start_Year (REAL), program.Title (TEXT), program.Director_ID (INT), program.Channel_ID (INT), ) Possible JOINs: director_admin.Director_ID = director.Director_ID director_admin.Channel_ID = channel.Channel_ID program.Director_ID = director.Director_ID program.Channel_ID = channel.Channel_ID
SELECT director.name , director.age FROM program JOIN director ON program.director_id = director.director_id GROUP BY program.director_id ORDER BY count(*) DESC LIMIT 1
{ 'program': ['program_id', 'director_id'], 'director': ['director_id', 'name', 'age'] }
CREATE TABLE channel ( channel.Channel_ID (INT), channel.Name (TEXT), channel.Analogue_terrestrial_channel (TEXT), channel.Digital_terrestrial_channel (TEXT), channel.Internet (TEXT), ) CREATE TABLE director ( director.Director_ID (INT), director.Name (TEXT), director.Age (INT), ) CREATE TABLE director_admin ( director_admin.Director_ID (INT), director_admin.Channel_ID (INT), director_admin.Is_first_director (bool), ) CREATE TABLE program ( program.Program_ID (INT), program.Start_Year (REAL), program.Title (TEXT), program.Director_ID (INT), program.Channel_ID (INT), ) Possible JOINs: director_admin.Director_ID = director.Director_ID director_admin.Channel_ID = channel.Channel_ID program.Director_ID = director.Director_ID program.Channel_ID = channel.Channel_ID
Table channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) Table director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) Table director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) Table program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
CREATE TABLE channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) CREATE TABLE director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) CREATE TABLE director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) CREATE TABLE program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
Table channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) Table director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) Table director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) Table program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
CREATE TABLE channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) CREATE TABLE director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) CREATE TABLE director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) CREATE TABLE program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
{ 'channel': ['Channel_ID', 'Name', 'Analogue_terrestrial_channel', 'Digital_terrestrial_channel', 'Internet'], 'director': ['Director_ID', 'Name', 'Age'], 'program': ['Program_ID', 'Start_Year', 'Title', 'Director_ID', 'Channel_ID'], 'director_admin': ['Director_ID', 'Channel_ID', 'Is_first_director'] }
{ 'program': ['Program_ID', 'Director_ID'], 'director': ['Director_ID', 'Name', 'Age'] }
TABLE channel ( channel.Channel_ID (INT), channel.Name (TEXT), channel.Analogue_terrestrial_channel (TEXT), channel.Digital_terrestrial_channel (TEXT), channel.Internet (TEXT), ) TABLE director ( director.Director_ID (INT), director.Name (TEXT), director.Age (INT), ) TABLE director_admin ( director_admin.Director_ID (INT), director_admin.Channel_ID (INT), director_admin.Is_first_director (bool), ) TABLE program ( program.Program_ID (INT), program.Start_Year (REAL), program.Title (TEXT), program.Director_ID (INT), program.Channel_ID (INT), ) Possible JOINs: director_admin.Director_ID = director.Director_ID director_admin.Channel_ID = channel.Channel_ID program.Director_ID = director.Director_ID program.Channel_ID = channel.Channel_ID
TABLE channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) TABLE director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) TABLE director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) TABLE program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
TABLE channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) TABLE director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) TABLE director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) TABLE program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
government_shift
CREATE TABLE "Analytical_Layer" ( "Analytical_ID" INTEGER NOT NULL, "Customers_and_Services_ID" VARCHAR(40) NOT NULL, "Pattern_Recognition" VARCHAR(255) NOT NULL, "Analytical_Layer_Type_Code" CHAR(15), PRIMARY KEY ("Analytical_ID"), FOREIGN KEY("Customers_and_Services_ID") REFERENCES "Customers_and_Services" ("Customers_and_Services_ID") ) CREATE TABLE "Channels" ( "Channel_ID" INTEGER NOT NULL, "Channel_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Channel_ID") ) CREATE TABLE "Customer_Interactions" ( "Customer_Interaction_ID" INTEGER NOT NULL, "Channel_ID" INTEGER, "Customer_ID" INTEGER, "Service_ID" INTEGER, "Status_Code" CHAR(15), "Services_and_Channels_Details" VARCHAR(255), PRIMARY KEY ("Customer_Interaction_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Channel_ID") REFERENCES "Channels" ("Channel_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Customers" ( "Customer_ID" INTEGER NOT NULL, "Customer_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Customer_ID") ) CREATE TABLE "Customers_and_Services" ( "Customers_and_Services_ID" INTEGER NOT NULL, "Customer_ID" INTEGER, "Service_ID" INTEGER, "Customers_and_Services_Details" CHAR(15) NOT NULL, PRIMARY KEY ("Customers_and_Services_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Integration_Platform" ( "Integration_Platform_ID" INTEGER NOT NULL, "Customer_Interaction_ID" INTEGER NOT NULL, "Integration_Platform_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Integration_Platform_ID"), FOREIGN KEY("Customer_Interaction_ID") REFERENCES "Customer_Interactions" ("Customer_Interaction_ID") ) CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_Details" VARCHAR(255), PRIMARY KEY ("Service_ID") )
Find all the services that has been used by the customer with details "Hardy Kutch".
hard
Table Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) Table Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) Table Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) Table Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) Table Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) Table Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) Table Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
SELECT services.service_details FROM customers JOIN customers_and_services ON customers.customer_id = customers_and_services.customer_id JOIN services ON customers_and_services.service_id = services.service_id WHERE customers.customer_details = "Hardy Kutch"
{ 'customers': ['customer_id', 'customer_details'], 'customers_and_services': ['customers_and_services_id', 'customer_id', 'service_id'], 'services': ['service_id', 'service_details'] }
CREATE TABLE Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) CREATE TABLE Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) CREATE TABLE Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) CREATE TABLE Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) CREATE TABLE Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) CREATE TABLE Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) CREATE TABLE Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
Table Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) Table Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) Table Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) Table Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) Table Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) Table Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
CREATE TABLE Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) CREATE TABLE Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) CREATE TABLE Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) CREATE TABLE Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) CREATE TABLE Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) CREATE TABLE Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
Table analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) Table channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) Table customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) Table customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) Table customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) Table integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) Table services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
CREATE TABLE analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) CREATE TABLE channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) CREATE TABLE customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) CREATE TABLE customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) CREATE TABLE integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) CREATE TABLE services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
{ 'Services': ['Service_ID', 'Service_Details'], 'Customers': ['Customer_ID', 'Customer_Details'], 'Channels': ['Channel_ID', 'Channel_Details'], 'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID', 'Customers_and_Services_Details'], 'Customer_Interactions': ['Customer_Interaction_ID', 'Channel_ID', 'Customer_ID', 'Service_ID', 'Status_Code', 'Services_and_Channels_Details'], 'Integration_Platform': ['Integration_Platform_ID', 'Customer_Interaction_ID', 'Integration_Platform_Details'], 'Analytical_Layer': ['Analytical_ID', 'Customers_and_Services_ID', 'Pattern_Recognition', 'Analytical_Layer_Type_Code'] }
{ 'Customers': ['Customer_ID', 'Customer_Details'], 'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID'], 'Services': ['Service_ID', 'Service_Details'] }
TABLE Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) TABLE Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) TABLE Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) TABLE Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) TABLE Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) TABLE Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) TABLE Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
TABLE Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) TABLE Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) TABLE Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) TABLE Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) TABLE Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) TABLE Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
TABLE analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) TABLE channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) TABLE customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) TABLE customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) TABLE customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) TABLE integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) TABLE services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_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) )
List all process ids with no document.
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_id FROM Business_processes EXCEPT SELECT process_id FROM Documents_processes
{ 'business_processes': ['process_id'], 'documents_processes': ['document_id', 'process_id'] }
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'], 'Documents_Processes': ['document_id', 'process_id'] }
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
pilot_1
CREATE TABLE "Hangar" ( plane_name CHAR(15) NOT NULL, location CHAR(15), PRIMARY KEY (plane_name) ) CREATE TABLE "PilotSkills" ( pilot_name CHAR(15) NOT NULL, plane_name CHAR(15) NOT NULL, age INTEGER, PRIMARY KEY (pilot_name, plane_name), FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name) )
What are the locations of the different planes, ordered by plane name?
easy
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
SELECT LOCATION FROM hangar ORDER BY plane_name
{ 'hangar': ['plane_name', 'location'] }
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) Table pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
CREATE TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) CREATE TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
{ 'PilotSkills': ['pilot_name', 'plane_name', 'age'], 'Hangar': ['plane_name', 'location'] }
{ 'Hangar': ['plane_name', 'location'] }
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
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") )
Show all home conferences.
easy
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 DISTINCT home_conference FROM University
{ 'university': ['university_id', 'home_conference'] }
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', 'Home_Conference'] }
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
restaurant_bills
CREATE TABLE branch ( "Branch_ID" INTEGER, "Manager" TEXT, "Years_opened" INTEGER, "Location_of_office" TEXT, PRIMARY KEY ("Branch_ID") ) CREATE TABLE customer ( "Customer_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Card_Credit" REAL, "Level_of_Membership" INTEGER, PRIMARY KEY ("Customer_ID") ) CREATE TABLE customer_order ( "Customer_ID" INTEGER, "Branch_ID" INTEGER, "Dish_Name" TEXT, "Quantity" INTEGER, PRIMARY KEY ("Customer_ID", "Branch_ID", "Dish_Name"), FOREIGN KEY("Branch_ID") REFERENCES branch ("Branch_ID"), FOREIGN KEY("Customer_ID") REFERENCES customer ("Customer_ID") )
Which nationality does the most customers have?
hard
Table branch ( branch.Branch_ID (INT), branch.Manager (TEXT), branch.Years_opened (INT), branch.Location_of_office (TEXT), ) Table customer ( customer.Customer_ID (INT), customer.Name (TEXT), customer.Nationality (TEXT), customer.Card_Credit (REAL), customer.Level_of_Membership (INT), ) Table customer_order ( customer_order.Customer_ID (INT), customer_order.Branch_ID (INT), customer_order.Dish_Name (TEXT), customer_order.Quantity (INT), ) Possible JOINs: customer_order.Customer_ID = customer.Customer_ID customer_order.Branch_ID = branch.Branch_ID
SELECT Nationality FROM customer GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
{ 'customer': ['customer_id', 'nationality'] }
CREATE TABLE branch ( branch.Branch_ID (INT), branch.Manager (TEXT), branch.Years_opened (INT), branch.Location_of_office (TEXT), ) CREATE TABLE customer ( customer.Customer_ID (INT), customer.Name (TEXT), customer.Nationality (TEXT), customer.Card_Credit (REAL), customer.Level_of_Membership (INT), ) CREATE TABLE customer_order ( customer_order.Customer_ID (INT), customer_order.Branch_ID (INT), customer_order.Dish_Name (TEXT), customer_order.Quantity (INT), ) Possible JOINs: customer_order.Customer_ID = customer.Customer_ID customer_order.Branch_ID = branch.Branch_ID
Table branch ( branch.branch_id (INT), branch.manager (TEXT), branch.years_opened (INT), branch.location_of_office (TEXT), ) Table customer ( customer.customer_id (INT), customer.name (TEXT), customer.nationality (TEXT), customer.card_credit (REAL), customer.level_of_membership (INT), ) Table customer_order ( customer_order.customer_id (INT), customer_order.branch_id (INT), customer_order.dish_name (TEXT), customer_order.quantity (INT), ) Possible JOINs: customer_order.customer_id = customer.customer_id customer_order.branch_id = branch.branch_id
CREATE TABLE branch ( branch.branch_id (INT), branch.manager (TEXT), branch.years_opened (INT), branch.location_of_office (TEXT), ) CREATE TABLE customer ( customer.customer_id (INT), customer.name (TEXT), customer.nationality (TEXT), customer.card_credit (REAL), customer.level_of_membership (INT), ) CREATE TABLE customer_order ( customer_order.customer_id (INT), customer_order.branch_id (INT), customer_order.dish_name (TEXT), customer_order.quantity (INT), ) Possible JOINs: customer_order.customer_id = customer.customer_id customer_order.branch_id = branch.branch_id
Table branch ( branch.branch_id (INT), branch.manager (TEXT), branch.years_opened (INT), branch.location_of_office (TEXT), ) Table customer ( customer.customer_id (INT), customer.name (TEXT), customer.nationality (TEXT), customer.card_credit (REAL), customer.level_of_membership (INT), ) Table customer_order ( customer_order.customer_id (INT), customer_order.branch_id (INT), customer_order.dish_name (TEXT), customer_order.quantity (INT), ) Possible JOINs: customer_order.customer_id = customer.customer_id customer_order.branch_id = branch.branch_id
CREATE TABLE branch ( branch.branch_id (INT), branch.manager (TEXT), branch.years_opened (INT), branch.location_of_office (TEXT), ) CREATE TABLE customer ( customer.customer_id (INT), customer.name (TEXT), customer.nationality (TEXT), customer.card_credit (REAL), customer.level_of_membership (INT), ) CREATE TABLE customer_order ( customer_order.customer_id (INT), customer_order.branch_id (INT), customer_order.dish_name (TEXT), customer_order.quantity (INT), ) Possible JOINs: customer_order.customer_id = customer.customer_id customer_order.branch_id = branch.branch_id
{ 'customer': ['Customer_ID', 'Name', 'Nationality', 'Card_Credit', 'Level_of_Membership'], 'branch': ['Branch_ID', 'Manager', 'Years_opened', 'Location_of_office'], 'customer_order': ['Customer_ID', 'Branch_ID', 'Dish_Name', 'Quantity'] }
{ 'customer': ['Customer_ID', 'Nationality'] }
TABLE branch ( branch.Branch_ID (INT), branch.Manager (TEXT), branch.Years_opened (INT), branch.Location_of_office (TEXT), ) TABLE customer ( customer.Customer_ID (INT), customer.Name (TEXT), customer.Nationality (TEXT), customer.Card_Credit (REAL), customer.Level_of_Membership (INT), ) TABLE customer_order ( customer_order.Customer_ID (INT), customer_order.Branch_ID (INT), customer_order.Dish_Name (TEXT), customer_order.Quantity (INT), ) Possible JOINs: customer_order.Customer_ID = customer.Customer_ID customer_order.Branch_ID = branch.Branch_ID
TABLE branch ( branch.branch_id (INT), branch.manager (TEXT), branch.years_opened (INT), branch.location_of_office (TEXT), ) TABLE customer ( customer.customer_id (INT), customer.name (TEXT), customer.nationality (TEXT), customer.card_credit (REAL), customer.level_of_membership (INT), ) TABLE customer_order ( customer_order.customer_id (INT), customer_order.branch_id (INT), customer_order.dish_name (TEXT), customer_order.quantity (INT), ) Possible JOINs: customer_order.customer_id = customer.customer_id customer_order.branch_id = branch.branch_id
TABLE branch ( branch.branch_id (INT), branch.manager (TEXT), branch.years_opened (INT), branch.location_of_office (TEXT), ) TABLE customer ( customer.customer_id (INT), customer.name (TEXT), customer.nationality (TEXT), customer.card_credit (REAL), customer.level_of_membership (INT), ) TABLE customer_order ( customer_order.customer_id (INT), customer_order.branch_id (INT), customer_order.dish_name (TEXT), customer_order.quantity (INT), ) Possible JOINs: customer_order.customer_id = customer.customer_id customer_order.branch_id = branch.branch_id
headphone_store
CREATE TABLE headphone ( "Headphone_ID" INTEGER, "Model" TEXT, "Class" TEXT, "Driver-matched_dB" REAL, "Construction" TEXT, "Earpads" TEXT, "Price" INTEGER, PRIMARY KEY ("Headphone_ID") ) CREATE TABLE stock ( "Store_ID" INTEGER, "Headphone_ID" INTEGER, "Quantity" INTEGER, PRIMARY KEY ("Store_ID", "Headphone_ID"), FOREIGN KEY("Headphone_ID") REFERENCES headphone ("Headphone_ID"), FOREIGN KEY("Store_ID") REFERENCES store ("Store_ID") ) CREATE TABLE store ( "Store_ID" INTEGER, "Name" TEXT, "Neighborhood" TEXT, "Parking" TEXT, "Date_Opened" TEXT, PRIMARY KEY ("Store_ID") )
Which headphone models do not have any stock in any store?
hard
Table headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) Table stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) Table store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
SELECT model FROM headphone WHERE headphone_id NOT IN (SELECT headphone_id FROM stock)
{ 'headphone': ['headphone_id', 'model'], 'stock': ['store_id', 'headphone_id'] }
CREATE TABLE headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) CREATE TABLE stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) CREATE TABLE store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
Table headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) Table stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) Table store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
CREATE TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) CREATE TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) CREATE TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
Table headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) Table stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) Table store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
CREATE TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) CREATE TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) CREATE TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
{ 'headphone': ['Headphone_ID', 'Model', 'Class', 'Driver-matched_dB', 'Construction', 'Earpads', 'Price'], 'store': ['Store_ID', 'Name', 'Neighborhood', 'Parking', 'Date_Opened'], 'stock': ['Store_ID', 'Headphone_ID', 'Quantity'] }
{ 'headphone': ['Headphone_ID', 'Model'], 'stock': ['Store_ID', 'Headphone_ID'] }
TABLE headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) TABLE stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) TABLE store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_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") )
What is the cheapest good with cheese flavor?
easy
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 min(price) FROM goods WHERE flavor = "Cheese"
{ 'goods': ['id', 'flavor', 'price'] }
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'] }
{ 'goods': ['Id', 'Flavor', 'Price'] }
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
government_shift
CREATE TABLE "Analytical_Layer" ( "Analytical_ID" INTEGER NOT NULL, "Customers_and_Services_ID" VARCHAR(40) NOT NULL, "Pattern_Recognition" VARCHAR(255) NOT NULL, "Analytical_Layer_Type_Code" CHAR(15), PRIMARY KEY ("Analytical_ID"), FOREIGN KEY("Customers_and_Services_ID") REFERENCES "Customers_and_Services" ("Customers_and_Services_ID") ) CREATE TABLE "Channels" ( "Channel_ID" INTEGER NOT NULL, "Channel_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Channel_ID") ) CREATE TABLE "Customer_Interactions" ( "Customer_Interaction_ID" INTEGER NOT NULL, "Channel_ID" INTEGER, "Customer_ID" INTEGER, "Service_ID" INTEGER, "Status_Code" CHAR(15), "Services_and_Channels_Details" VARCHAR(255), PRIMARY KEY ("Customer_Interaction_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Channel_ID") REFERENCES "Channels" ("Channel_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Customers" ( "Customer_ID" INTEGER NOT NULL, "Customer_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Customer_ID") ) CREATE TABLE "Customers_and_Services" ( "Customers_and_Services_ID" INTEGER NOT NULL, "Customer_ID" INTEGER, "Service_ID" INTEGER, "Customers_and_Services_Details" CHAR(15) NOT NULL, PRIMARY KEY ("Customers_and_Services_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Integration_Platform" ( "Integration_Platform_ID" INTEGER NOT NULL, "Customer_Interaction_ID" INTEGER NOT NULL, "Integration_Platform_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Integration_Platform_ID"), FOREIGN KEY("Customer_Interaction_ID") REFERENCES "Customer_Interactions" ("Customer_Interaction_ID") ) CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_Details" VARCHAR(255), PRIMARY KEY ("Service_ID") )
How many services are there?
easy
Table Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) Table Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) Table Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) Table Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) Table Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) Table Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) Table Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
SELECT count(*) FROM services
{ 'services': ['service_id'] }
CREATE TABLE Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) CREATE TABLE Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) CREATE TABLE Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) CREATE TABLE Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) CREATE TABLE Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) CREATE TABLE Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) CREATE TABLE Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
Table Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) Table Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) Table Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) Table Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) Table Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) Table Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
CREATE TABLE Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) CREATE TABLE Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) CREATE TABLE Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) CREATE TABLE Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) CREATE TABLE Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) CREATE TABLE Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
Table analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) Table channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) Table customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) Table customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) Table customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) Table integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) Table services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
CREATE TABLE analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) CREATE TABLE channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) CREATE TABLE customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) CREATE TABLE customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) CREATE TABLE integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) CREATE TABLE services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
{ 'Services': ['Service_ID', 'Service_Details'], 'Customers': ['Customer_ID', 'Customer_Details'], 'Channels': ['Channel_ID', 'Channel_Details'], 'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID', 'Customers_and_Services_Details'], 'Customer_Interactions': ['Customer_Interaction_ID', 'Channel_ID', 'Customer_ID', 'Service_ID', 'Status_Code', 'Services_and_Channels_Details'], 'Integration_Platform': ['Integration_Platform_ID', 'Customer_Interaction_ID', 'Integration_Platform_Details'], 'Analytical_Layer': ['Analytical_ID', 'Customers_and_Services_ID', 'Pattern_Recognition', 'Analytical_Layer_Type_Code'] }
{ 'Services': ['Service_ID'] }
TABLE Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) TABLE Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) TABLE Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) TABLE Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) TABLE Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) TABLE Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) TABLE Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
TABLE Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) TABLE Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) TABLE Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) TABLE Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) TABLE Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) TABLE Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
TABLE analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) TABLE channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) TABLE customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) TABLE customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) TABLE customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) TABLE integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) TABLE services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
car_road_race
CREATE TABLE driver ( "Driver_ID" INTEGER, "Driver_Name" TEXT, "Entrant" TEXT, "Constructor" TEXT, "Chassis" TEXT, "Engine" TEXT, "Age" INTEGER, PRIMARY KEY ("Driver_ID") ) CREATE TABLE race ( "Road" INTEGER, "Driver_ID" INTEGER, "Race_Name" TEXT, "Pole_Position" TEXT, "Fastest_Lap" TEXT, "Winning_driver" TEXT, "Winning_team" TEXT, "Report" TEXT, PRIMARY KEY ("Road"), FOREIGN KEY("Driver_ID") REFERENCES driver ("Driver_ID") )
Please show the names of drivers and the number of races they participate in.
medium
Table driver ( driver.Driver_ID (INT), driver.Driver_Name (TEXT), driver.Entrant (TEXT), driver.Constructor (TEXT), driver.Chassis (TEXT), driver.Engine (TEXT), driver.Age (INT), ) Table race ( race.Road (INT), race.Driver_ID (INT), race.Race_Name (TEXT), race.Pole_Position (TEXT), race.Fastest_Lap (TEXT), race.Winning_driver (TEXT), race.Winning_team (TEXT), race.Report (TEXT), ) Possible JOINs: race.Driver_ID = driver.Driver_ID
SELECT driver.Driver_Name , COUNT(*) FROM driver JOIN race ON driver.Driver_ID = race.Driver_ID GROUP BY driver.Driver_ID
{ 'driver': ['driver_id', 'driver_name'], 'race': ['road', 'driver_id'] }
CREATE TABLE driver ( driver.Driver_ID (INT), driver.Driver_Name (TEXT), driver.Entrant (TEXT), driver.Constructor (TEXT), driver.Chassis (TEXT), driver.Engine (TEXT), driver.Age (INT), ) CREATE TABLE race ( race.Road (INT), race.Driver_ID (INT), race.Race_Name (TEXT), race.Pole_Position (TEXT), race.Fastest_Lap (TEXT), race.Winning_driver (TEXT), race.Winning_team (TEXT), race.Report (TEXT), ) Possible JOINs: race.Driver_ID = driver.Driver_ID
Table driver ( driver.driver_id (INT), driver.driver_name (TEXT), driver.entrant (TEXT), driver.constructor (TEXT), driver.chassis (TEXT), driver.engine (TEXT), driver.age (INT), ) Table race ( race.road (INT), race.driver_id (INT), race.race_name (TEXT), race.pole_position (TEXT), race.fastest_lap (TEXT), race.winning_driver (TEXT), race.winning_team (TEXT), race.report (TEXT), ) Possible JOINs: race.driver_id = driver.driver_id
CREATE TABLE driver ( driver.driver_id (INT), driver.driver_name (TEXT), driver.entrant (TEXT), driver.constructor (TEXT), driver.chassis (TEXT), driver.engine (TEXT), driver.age (INT), ) CREATE TABLE race ( race.road (INT), race.driver_id (INT), race.race_name (TEXT), race.pole_position (TEXT), race.fastest_lap (TEXT), race.winning_driver (TEXT), race.winning_team (TEXT), race.report (TEXT), ) Possible JOINs: race.driver_id = driver.driver_id
Table driver ( driver.driver_id (INT), driver.driver_name (TEXT), driver.entrant (TEXT), driver.constructor (TEXT), driver.chassis (TEXT), driver.engine (TEXT), driver.age (INT), ) Table race ( race.road (INT), race.driver_id (INT), race.race_name (TEXT), race.pole_position (TEXT), race.fastest_lap (TEXT), race.winning_driver (TEXT), race.winning_team (TEXT), race.report (TEXT), ) Possible JOINs: race.driver_id = driver.driver_id
CREATE TABLE driver ( driver.driver_id (INT), driver.driver_name (TEXT), driver.entrant (TEXT), driver.constructor (TEXT), driver.chassis (TEXT), driver.engine (TEXT), driver.age (INT), ) CREATE TABLE race ( race.road (INT), race.driver_id (INT), race.race_name (TEXT), race.pole_position (TEXT), race.fastest_lap (TEXT), race.winning_driver (TEXT), race.winning_team (TEXT), race.report (TEXT), ) Possible JOINs: race.driver_id = driver.driver_id
{ 'driver': ['Driver_ID', 'Driver_Name', 'Entrant', 'Constructor', 'Chassis', 'Engine', 'Age'], 'race': ['Road', 'Driver_ID', 'Race_Name', 'Pole_Position', 'Fastest_Lap', 'Winning_driver', 'Winning_team', 'Report'] }
{ 'driver': ['Driver_ID', 'Driver_Name'], 'race': ['Road', 'Driver_ID'] }
TABLE driver ( driver.Driver_ID (INT), driver.Driver_Name (TEXT), driver.Entrant (TEXT), driver.Constructor (TEXT), driver.Chassis (TEXT), driver.Engine (TEXT), driver.Age (INT), ) TABLE race ( race.Road (INT), race.Driver_ID (INT), race.Race_Name (TEXT), race.Pole_Position (TEXT), race.Fastest_Lap (TEXT), race.Winning_driver (TEXT), race.Winning_team (TEXT), race.Report (TEXT), ) Possible JOINs: race.Driver_ID = driver.Driver_ID
TABLE driver ( driver.driver_id (INT), driver.driver_name (TEXT), driver.entrant (TEXT), driver.constructor (TEXT), driver.chassis (TEXT), driver.engine (TEXT), driver.age (INT), ) TABLE race ( race.road (INT), race.driver_id (INT), race.race_name (TEXT), race.pole_position (TEXT), race.fastest_lap (TEXT), race.winning_driver (TEXT), race.winning_team (TEXT), race.report (TEXT), ) Possible JOINs: race.driver_id = driver.driver_id
TABLE driver ( driver.driver_id (INT), driver.driver_name (TEXT), driver.entrant (TEXT), driver.constructor (TEXT), driver.chassis (TEXT), driver.engine (TEXT), driver.age (INT), ) TABLE race ( race.road (INT), race.driver_id (INT), race.race_name (TEXT), race.pole_position (TEXT), race.fastest_lap (TEXT), race.winning_driver (TEXT), race.winning_team (TEXT), race.report (TEXT), ) Possible JOINs: race.driver_id = driver.driver_id
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) )
What is the name of the sailors who reserved boat with id 103?
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 FROM Sailors JOIN Reserves ON Sailors.sid = Reserves.sid WHERE Reserves.bid = 103
{ 'sailors': ['sid', 'name'], 'reserves': ['sid', '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
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', '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
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
e_commerce
CREATE TABLE "Customer_Payment_Methods" ( customer_id INTEGER NOT NULL, payment_method_code VARCHAR(10) NOT NULL, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, gender_code VARCHAR(1) NOT NULL, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), address_line_1 VARCHAR(255), town_city VARCHAR(50), county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, invoice_status_code VARCHAR(10) NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, product_id INTEGER NOT NULL, order_id INTEGER NOT NULL, order_item_status_code VARCHAR(10) NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, date_order_placed DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, product_name VARCHAR(80), product_price DECIMAL(19, 4) DEFAULT 0, product_color VARCHAR(50), product_size VARCHAR(50), product_description VARCHAR(255), PRIMARY KEY (product_id) ) CREATE TABLE "Shipment_Items" ( shipment_id INTEGER NOT NULL, order_item_id INTEGER NOT NULL, PRIMARY KEY (shipment_id, order_item_id), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id), FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id) ) CREATE TABLE "Shipments" ( shipment_id INTEGER, order_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, PRIMARY KEY (shipment_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) )
WHat are the first and last names, and middle initials of all customers who did not make any orders?
extra
Table Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) Table Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) Table Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) Table Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) Table Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) Table Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
SELECT customer_first_name , customer_middle_initial , customer_last_name FROM Customers EXCEPT SELECT Customers.customer_first_name , Customers.customer_middle_initial , Customers.customer_last_name FROM Customers JOIN Orders ON Customers.customer_id = Orders.customer_id
{ 'customers': ['customer_id', 'customer_first_name', 'customer_middle_initial', 'customer_last_name'], 'orders': ['order_id', 'customer_id'] }
CREATE TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) CREATE TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) CREATE TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) CREATE TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
Table Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) Table Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) Table Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) Table Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) Table Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) Table Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
CREATE TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) CREATE TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) CREATE TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) CREATE TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
Table customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) Table customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) Table invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) Table orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) Table products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) Table shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) Table shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
CREATE TABLE customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) CREATE TABLE invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) CREATE TABLE products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) CREATE TABLE shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) CREATE TABLE shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
{ 'Products': ['product_id', 'parent_product_id', 'product_name', 'product_price', 'product_color', 'product_size', 'product_description'], 'Customers': ['customer_id', 'gender_code', 'customer_first_name', 'customer_middle_initial', 'customer_last_name', 'email_address', 'login_name', 'login_password', 'phone_number', 'address_line_1', 'town_city', 'county', 'country'], 'Customer_Payment_Methods': ['customer_id', 'payment_method_code'], 'Invoices': ['invoice_number', 'invoice_status_code', 'invoice_date'], 'Orders': ['order_id', 'customer_id', 'order_status_code', 'date_order_placed'], 'Order_Items': ['order_item_id', 'product_id', 'order_id', 'order_item_status_code'], 'Shipments': ['shipment_id', 'order_id', 'invoice_number', 'shipment_tracking_number', 'shipment_date'], 'Shipment_Items': ['shipment_id', 'order_item_id'] }
{ 'Customers': ['customer_id', 'customer_first_name', 'customer_middle_initial', 'customer_last_name'], 'Orders': ['order_id', 'customer_id'] }
TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
TABLE customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) TABLE customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) TABLE invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) TABLE orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) TABLE products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) TABLE shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) TABLE shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
customers_and_orders
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_date DATETIME NOT NULL, order_status_code VARCHAR(15), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, address_id INTEGER NOT NULL, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(80), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE, PRIMARY KEY (product_id) )
Count the number of products.
easy
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
SELECT count(*) FROM Products
{ 'products': ['product_id'] }
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) Table customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) Table customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) Table products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
CREATE TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) CREATE TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) CREATE TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
{ 'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'], 'Addresses': ['address_id', 'address_details'], 'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'], 'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'], 'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity'] }
{ 'Products': ['product_id'] }
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_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) )
List the codes and descriptions for all process outcomes.
medium
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_outcome_code , process_outcome_description FROM Process_outcomes
{ 'process_outcomes': ['process_outcome_code', 'process_outcome_description'] }
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'] }
{ 'Process_Outcomes': ['process_outcome_code', 'process_outcome_description'] }
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
book_press
CREATE TABLE author ( "Author_ID" INTEGER, "Name" TEXT, "Age" INTEGER, "Gender" TEXT, PRIMARY KEY ("Author_ID") ) CREATE TABLE book ( "Book_ID" INTEGER, "Title" TEXT, "Book_Series" TEXT, "Author_ID" INTEGER, "Press_ID" INTEGER, "Sale_Amount" TEXT, "Release_date" TEXT, PRIMARY KEY ("Book_ID"), FOREIGN KEY("Press_ID") REFERENCES press ("Press_ID"), FOREIGN KEY("Author_ID") REFERENCES author ("Author_ID") ) CREATE TABLE press ( "Press_ID" INTEGER, "Name" TEXT, "Month_Profits_billion" REAL, "Year_Profits_billion" REAL, PRIMARY KEY ("Press_ID") )
Which authors have never published under the "Accor" press? Give me their names.
hard
Table author ( author.Author_ID (INT), author.Name (TEXT), author.Age (INT), author.Gender (TEXT), ) Table book ( book.Book_ID (INT), book.Title (TEXT), book.Book_Series (TEXT), book.Author_ID (INT), book.Press_ID (INT), book.Sale_Amount (TEXT), book.Release_date (TEXT), ) Table press ( press.Press_ID (INT), press.Name (TEXT), press.Month_Profits_billion (REAL), press.Year_Profits_billion (REAL), ) Possible JOINs: book.Author_ID = author.Author_ID book.Press_ID = press.Press_ID
SELECT name FROM author EXCEPT SELECT author.name FROM author JOIN book ON author.author_id = book.author_id JOIN press ON book.press_id = press.press_id WHERE press.name = 'Accor'
{ 'author': ['author_id', 'name'], 'book': ['book_id', 'author_id', 'press_id'], 'press': ['press_id', 'name'] }
CREATE TABLE author ( author.Author_ID (INT), author.Name (TEXT), author.Age (INT), author.Gender (TEXT), ) CREATE TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Book_Series (TEXT), book.Author_ID (INT), book.Press_ID (INT), book.Sale_Amount (TEXT), book.Release_date (TEXT), ) CREATE TABLE press ( press.Press_ID (INT), press.Name (TEXT), press.Month_Profits_billion (REAL), press.Year_Profits_billion (REAL), ) Possible JOINs: book.Author_ID = author.Author_ID book.Press_ID = press.Press_ID
Table author ( author.author_id (INT), author.name (TEXT), author.age (INT), author.gender (TEXT), ) Table book ( book.book_id (INT), book.title (TEXT), book.book_series (TEXT), book.author_id (INT), book.press_id (INT), book.sale_amount (TEXT), book.release_date (TEXT), ) Table press ( press.press_id (INT), press.name (TEXT), press.month_profits_billion (REAL), press.year_profits_billion (REAL), ) Possible JOINs: book.author_id = author.author_id book.press_id = press.press_id
CREATE TABLE author ( author.author_id (INT), author.name (TEXT), author.age (INT), author.gender (TEXT), ) CREATE TABLE book ( book.book_id (INT), book.title (TEXT), book.book_series (TEXT), book.author_id (INT), book.press_id (INT), book.sale_amount (TEXT), book.release_date (TEXT), ) CREATE TABLE press ( press.press_id (INT), press.name (TEXT), press.month_profits_billion (REAL), press.year_profits_billion (REAL), ) Possible JOINs: book.author_id = author.author_id book.press_id = press.press_id
Table author ( author.author_id (INT), author.name (TEXT), author.age (INT), author.gender (TEXT), ) Table book ( book.book_id (INT), book.title (TEXT), book.book_series (TEXT), book.author_id (INT), book.press_id (INT), book.sale_amount (TEXT), book.release_date (TEXT), ) Table press ( press.press_id (INT), press.name (TEXT), press.month_profits_billion (REAL), press.year_profits_billion (REAL), ) Possible JOINs: book.author_id = author.author_id book.press_id = press.press_id
CREATE TABLE author ( author.author_id (INT), author.name (TEXT), author.age (INT), author.gender (TEXT), ) CREATE TABLE book ( book.book_id (INT), book.title (TEXT), book.book_series (TEXT), book.author_id (INT), book.press_id (INT), book.sale_amount (TEXT), book.release_date (TEXT), ) CREATE TABLE press ( press.press_id (INT), press.name (TEXT), press.month_profits_billion (REAL), press.year_profits_billion (REAL), ) Possible JOINs: book.author_id = author.author_id book.press_id = press.press_id
{ 'author': ['Author_ID', 'Name', 'Age', 'Gender'], 'press': ['Press_ID', 'Name', 'Month_Profits_billion', 'Year_Profits_billion'], 'book': ['Book_ID', 'Title', 'Book_Series', 'Author_ID', 'Press_ID', 'Sale_Amount', 'Release_date'] }
{ 'author': ['Author_ID', 'Name'], 'book': ['Book_ID', 'Author_ID', 'Press_ID'], 'press': ['Press_ID', 'Name'] }
TABLE author ( author.Author_ID (INT), author.Name (TEXT), author.Age (INT), author.Gender (TEXT), ) TABLE book ( book.Book_ID (INT), book.Title (TEXT), book.Book_Series (TEXT), book.Author_ID (INT), book.Press_ID (INT), book.Sale_Amount (TEXT), book.Release_date (TEXT), ) TABLE press ( press.Press_ID (INT), press.Name (TEXT), press.Month_Profits_billion (REAL), press.Year_Profits_billion (REAL), ) Possible JOINs: book.Author_ID = author.Author_ID book.Press_ID = press.Press_ID
TABLE author ( author.author_id (INT), author.name (TEXT), author.age (INT), author.gender (TEXT), ) TABLE book ( book.book_id (INT), book.title (TEXT), book.book_series (TEXT), book.author_id (INT), book.press_id (INT), book.sale_amount (TEXT), book.release_date (TEXT), ) TABLE press ( press.press_id (INT), press.name (TEXT), press.month_profits_billion (REAL), press.year_profits_billion (REAL), ) Possible JOINs: book.author_id = author.author_id book.press_id = press.press_id
TABLE author ( author.author_id (INT), author.name (TEXT), author.age (INT), author.gender (TEXT), ) TABLE book ( book.book_id (INT), book.title (TEXT), book.book_series (TEXT), book.author_id (INT), book.press_id (INT), book.sale_amount (TEXT), book.release_date (TEXT), ) TABLE press ( press.press_id (INT), press.name (TEXT), press.month_profits_billion (REAL), press.year_profits_billion (REAL), ) Possible JOINs: book.author_id = author.author_id book.press_id = press.press_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 */
Find the details of the teachers who have taught the student with the earliest transcript issuance.
extra
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 FROM Teachers JOIN Classes ON Teachers.teacher_id = Classes.teacher_id JOIN Transcripts ON Classes.student_id = Transcripts.student_id ORDER BY Transcripts.date_of_transcript ASC LIMIT 1
{ 'teachers': ['teacher_id', 'teacher_details'], 'classes': ['class_id', 'student_id', 'teacher_id'], 'transcripts': ['transcript_id', 'student_id', 'date_of_transcript'] }
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'], 'Transcripts': ['transcript_id', 'student_id', 'date_of_transcript'] }
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
address_1
CREATE TABLE "City" ( city_code VARCHAR(3), city_name VARCHAR(25), state VARCHAR(2), country VARCHAR(25), latitude FLOAT, longitude FLOAT, PRIMARY KEY (city_code) ) CREATE TABLE "Direct_distance" ( city1_code VARCHAR(3), city2_code VARCHAR(3), distance INTEGER, FOREIGN KEY(city1_code) REFERENCES "City" (city_code), FOREIGN KEY(city2_code) REFERENCES "City" (city_code) ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID"), FOREIGN KEY(city_code) REFERENCES "City" (city_code) )
Give the name of the nearest city to Chicago.
extra
Table City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) Table Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) Table Student ( Student.StuID (INTEGER), Student.LName (VARCHAR(12)), Student.Fname (VARCHAR(12)), Student.Age (INTEGER), Student.Sex (VARCHAR(1)), Student.Major (INTEGER), Student.Advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
SELECT City.city_name FROM Direct_distance JOIN City ON Direct_distance.city1_code = City.city_code JOIN City ON Direct_distance.city2_code = City.city_code WHERE City.city_name = "Chicago" ORDER BY distance LIMIT 1
{ 'direct_distance': ['city1_code', 'city2_code', 'distance'], 'city': ['city_code', 'city_name'] }
CREATE TABLE City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) CREATE TABLE Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) CREATE TABLE Student ( Student.StuID (INTEGER), Student.LName (VARCHAR(12)), Student.Fname (VARCHAR(12)), Student.Age (INTEGER), Student.Sex (VARCHAR(1)), Student.Major (INTEGER), Student.Advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
Table City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) Table Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) Table Student ( Student.stuid (INTEGER), Student.lname (VARCHAR(12)), Student.fname (VARCHAR(12)), Student.age (INTEGER), Student.sex (VARCHAR(1)), Student.major (INTEGER), Student.advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
CREATE TABLE City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) CREATE TABLE Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) CREATE TABLE Student ( Student.stuid (INTEGER), Student.lname (VARCHAR(12)), Student.fname (VARCHAR(12)), Student.age (INTEGER), Student.sex (VARCHAR(1)), Student.major (INTEGER), Student.advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
Table city ( city.city_code (VARCHAR(3)), city.city_name (VARCHAR(25)), city.state (VARCHAR(2)), city.country (VARCHAR(25)), city.latitude (FLOAT), city.longitude (FLOAT), ) Table direct_distance ( direct_distance.city1_code (varchar(3)), direct_distance.city2_code (varchar(3)), direct_distance.distance (INTEGER), ) Table student ( student.stuid (INTEGER), student.lname (VARCHAR(12)), student.fname (VARCHAR(12)), student.age (INTEGER), student.sex (VARCHAR(1)), student.major (INTEGER), student.advisor (INTEGER), student.city_code (VARCHAR(3)), ) Possible JOINs: direct_distance.city1_code = city.city_code direct_distance.city2_code = city.city_code student.city_code = city.city_code
CREATE TABLE city ( city.city_code (VARCHAR(3)), city.city_name (VARCHAR(25)), city.state (VARCHAR(2)), city.country (VARCHAR(25)), city.latitude (FLOAT), city.longitude (FLOAT), ) CREATE TABLE direct_distance ( direct_distance.city1_code (varchar(3)), direct_distance.city2_code (varchar(3)), direct_distance.distance (INTEGER), ) CREATE TABLE student ( student.stuid (INTEGER), student.lname (VARCHAR(12)), student.fname (VARCHAR(12)), student.age (INTEGER), student.sex (VARCHAR(1)), student.major (INTEGER), student.advisor (INTEGER), student.city_code (VARCHAR(3)), ) Possible JOINs: direct_distance.city1_code = city.city_code direct_distance.city2_code = city.city_code student.city_code = city.city_code
{ 'Student': ['StuID', 'LName', 'Fname', 'Age', 'Sex', 'Major', 'Advisor', 'city_code'], 'Direct_distance': ['city1_code', 'city2_code', 'distance'], 'City': ['city_code', 'city_name', 'state', 'country', 'latitude', 'longitude'] }
{ 'Direct_distance': ['city1_code', 'city2_code', 'distance'], 'City': ['city_code', 'city_name'] }
TABLE City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) TABLE Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) TABLE Student ( Student.StuID (INTEGER), Student.LName (VARCHAR(12)), Student.Fname (VARCHAR(12)), Student.Age (INTEGER), Student.Sex (VARCHAR(1)), Student.Major (INTEGER), Student.Advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
TABLE City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) TABLE Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) TABLE Student ( Student.stuid (INTEGER), Student.lname (VARCHAR(12)), Student.fname (VARCHAR(12)), Student.age (INTEGER), Student.sex (VARCHAR(1)), Student.major (INTEGER), Student.advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
TABLE city ( city.city_code (VARCHAR(3)), city.city_name (VARCHAR(25)), city.state (VARCHAR(2)), city.country (VARCHAR(25)), city.latitude (FLOAT), city.longitude (FLOAT), ) TABLE direct_distance ( direct_distance.city1_code (varchar(3)), direct_distance.city2_code (varchar(3)), direct_distance.distance (INTEGER), ) TABLE student ( student.stuid (INTEGER), student.lname (VARCHAR(12)), student.fname (VARCHAR(12)), student.age (INTEGER), student.sex (VARCHAR(1)), student.major (INTEGER), student.advisor (INTEGER), student.city_code (VARCHAR(3)), ) Possible JOINs: direct_distance.city1_code = city.city_code direct_distance.city2_code = city.city_code student.city_code = city.city_code
customers_and_orders
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_date DATETIME NOT NULL, order_status_code VARCHAR(15), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, address_id INTEGER NOT NULL, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(80), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE, PRIMARY KEY (product_id) )
What are the names of all Hardware products, sorted by price ascending?
medium
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
SELECT product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC
{ 'products': ['product_id', 'product_type_code', 'product_name', 'product_price'] }
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) Table customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) Table customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) Table products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
CREATE TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) CREATE TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) CREATE TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
{ 'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'], 'Addresses': ['address_id', 'address_details'], 'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'], 'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'], 'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity'] }
{ 'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'] }
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_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) )
Show all author names.
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 author_name 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
pilot_1
CREATE TABLE "Hangar" ( plane_name CHAR(15) NOT NULL, location CHAR(15), PRIMARY KEY (plane_name) ) CREATE TABLE "PilotSkills" ( pilot_name CHAR(15) NOT NULL, plane_name CHAR(15) NOT NULL, age INTEGER, PRIMARY KEY (pilot_name, plane_name), FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name) )
How many pilots whose planes are in Chicago?
medium
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
SELECT count(DISTINCT pilotskills.pilot_name) FROM pilotskills JOIN hangar ON pilotskills.plane_name = hangar.plane_name WHERE hangar.location = 'Chicago'
{ 'pilotskills': ['pilot_name', 'plane_name'], 'hangar': ['plane_name', 'location'] }
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) Table pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
CREATE TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) CREATE TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
{ 'PilotSkills': ['pilot_name', 'plane_name', 'age'], 'Hangar': ['plane_name', 'location'] }
{ 'PilotSkills': ['pilot_name', 'plane_name'], 'Hangar': ['plane_name', 'location'] }
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
customers_and_orders
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_date DATETIME NOT NULL, order_status_code VARCHAR(15), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, address_id INTEGER NOT NULL, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(80), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE, PRIMARY KEY (product_id) )
List all product names in descending order of price.
easy
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
SELECT product_name FROM Products ORDER BY product_price DESC
{ 'products': ['product_id', 'product_name', 'product_price'] }
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) Table customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) Table customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) Table products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
CREATE TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) CREATE TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) CREATE TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
{ 'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'], 'Addresses': ['address_id', 'address_details'], 'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'], 'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'], 'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity'] }
{ 'Products': ['product_id', 'product_name', 'product_price'] }
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
cre_Doc_and_collections
CREATE TABLE "Collection_Subset_Members" ( "Collection_ID" INTEGER NOT NULL, "Related_Collection_ID" INTEGER NOT NULL, "Collection_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Collection_ID", "Related_Collection_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Related_Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Collection_Subset_ID") REFERENCES "Collection_Subsets" ("Collection_Subset_ID") ) CREATE TABLE "Collection_Subsets" ( "Collection_Subset_ID" INTEGER NOT NULL, "Collection_Subset_Name" VARCHAR(255) NOT NULL, "Collecrtion_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Collection_Subset_ID") ) CREATE TABLE "Collections" ( "Collection_ID" INTEGER NOT NULL, "Parent_Collection_ID" INTEGER, "Collection_Name" VARCHAR(255), "Collection_Description" VARCHAR(255), PRIMARY KEY ("Collection_ID") ) CREATE TABLE "Document_Objects" ( "Document_Object_ID" INTEGER NOT NULL, "Parent_Document_Object_ID" INTEGER, "Owner" VARCHAR(255), "Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_Object_ID") ) CREATE TABLE "Document_Subset_Members" ( "Document_Object_ID" INTEGER NOT NULL, "Related_Document_Object_ID" INTEGER NOT NULL, "Document_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Related_Document_Object_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Document_Subset_ID") REFERENCES "Document_Subsets" ("Document_Subset_ID"), FOREIGN KEY("Related_Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID") ) CREATE TABLE "Document_Subsets" ( "Document_Subset_ID" INTEGER NOT NULL, "Document_Subset_Name" VARCHAR(255) NOT NULL, "Document_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Subset_ID") ) CREATE TABLE "Documents_in_Collections" ( "Document_Object_ID" INTEGER NOT NULL, "Collection_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Collection_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID") )
How many collections that are related to collection named Best?
medium
Table Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) Table Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) Table Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
SELECT count(DISTINCT Collection_Subset_Members.Related_Collection_ID) FROM Collection_Subset_Members JOIN Collections ON Collection_Subset_Members.Collection_ID = Collections.Collection_ID WHERE Collections.Collection_Name = "Best";
{ 'collection_subset_members': ['collection_id', 'related_collection_id'], 'collections': ['collection_id', 'collection_name'] }
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
Table Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) Table Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) Table Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
Table collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) Table collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) Table collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) Table document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) Table document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) Table document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) Table documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
CREATE TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) CREATE TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) CREATE TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) CREATE TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) CREATE TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
{ 'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name', 'Document_Subset_Details'], 'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name', 'Collecrtion_Subset_Details'], 'Document_Objects': ['Document_Object_ID', 'Parent_Document_Object_ID', 'Owner', 'Description', 'Other_Details'], 'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name', 'Collection_Description'], 'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'], 'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'], 'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID', 'Collection_Subset_ID'] }
{ 'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID'], 'Collections': ['Collection_ID', 'Collection_Name'] }
TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
conference
CREATE TABLE conference ( "Conference_ID" INTEGER, "Conference_Name" TEXT, "Year" INTEGER, "Location" TEXT, PRIMARY KEY ("Conference_ID") ) CREATE TABLE conference_participation ( "Conference_ID" INTEGER, "staff_ID" INTEGER, role TEXT, PRIMARY KEY ("staff_ID", "Conference_ID"), FOREIGN KEY("Conference_ID") REFERENCES conference ("Conference_ID"), FOREIGN KEY("staff_ID") REFERENCES staff ("staff_ID") ) CREATE TABLE institution ( "Institution_ID" INTEGER, "Institution_Name" TEXT, "Location" TEXT, "Founded" INTEGER, PRIMARY KEY ("Institution_ID") ) CREATE TABLE staff ( "staff_ID" INTEGER, name TEXT, "Age" INTEGER, "Nationality" TEXT, "Institution_ID" INTEGER, PRIMARY KEY ("staff_ID"), FOREIGN KEY("Institution_ID") REFERENCES institution ("Institution_ID") )
List all distinct conference names.
easy
Table conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) Table conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) Table institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) Table staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
SELECT DISTINCT conference_name FROM conference
{ 'conference': ['conference_id', 'conference_name'] }
CREATE TABLE conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) CREATE TABLE staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
Table conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) Table conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) Table institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) Table staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
CREATE TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) CREATE TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
Table conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) Table conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) Table institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) Table staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
CREATE TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) CREATE TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
{ 'conference': ['Conference_ID', 'Conference_Name', 'Year', 'Location'], 'institution': ['Institution_ID', 'Institution_Name', 'Location', 'Founded'], 'staff': ['staff_ID', 'name', 'Age', 'Nationality', 'Institution_ID'], 'conference_participation': ['Conference_ID', 'staff_ID', 'role'] }
{ 'conference': ['Conference_ID', 'Conference_Name'] }
TABLE conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) TABLE conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) TABLE staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
district_spokesman
CREATE TABLE district ( "District_ID" INTEGER, "Name" TEXT, "Area_km" REAL, "Population" REAL, "Density_km" REAL, "Government_website" TEXT, PRIMARY KEY ("District_ID") ) CREATE TABLE spokesman ( "Spokesman_ID" INTEGER, "Name" TEXT, "Age" INTEGER, "Speach_title" TEXT, "Rank_position" REAL, "Points" REAL, PRIMARY KEY ("Spokesman_ID") ) CREATE TABLE spokesman_district ( "Spokesman_ID" INTEGER, "District_ID" INTEGER, "Start_year" TEXT, PRIMARY KEY ("Spokesman_ID"), FOREIGN KEY("Spokesman_ID") REFERENCES spokesman ("Spokesman_ID"), FOREIGN KEY("District_ID") REFERENCES district ("District_ID") )
Find the number of districts which have no spokesmen.
extra
Table district ( district.District_ID (INT), district.Name (TEXT), district.Area_km (REAL), district.Population (REAL), district.Density_km (REAL), district.Government_website (TEXT), ) Table spokesman ( spokesman.Spokesman_ID (INT), spokesman.Name (TEXT), spokesman.Age (INT), spokesman.Speach_title (TEXT), spokesman.Rank_position (REAL), spokesman.Points (REAL), ) Table spokesman_district ( spokesman_district.Spokesman_ID (INT), spokesman_district.District_ID (INT), spokesman_district.Start_year (TEXT), ) Possible JOINs: spokesman_district.Spokesman_ID = spokesman.Spokesman_ID spokesman_district.District_ID = district.District_ID
SELECT count(*) FROM district WHERE district_id NOT IN (SELECT district_id FROM spokesman_district)
{ 'district': ['district_id'], 'spokesman_district': ['spokesman_id', 'district_id'] }
CREATE TABLE district ( district.District_ID (INT), district.Name (TEXT), district.Area_km (REAL), district.Population (REAL), district.Density_km (REAL), district.Government_website (TEXT), ) CREATE TABLE spokesman ( spokesman.Spokesman_ID (INT), spokesman.Name (TEXT), spokesman.Age (INT), spokesman.Speach_title (TEXT), spokesman.Rank_position (REAL), spokesman.Points (REAL), ) CREATE TABLE spokesman_district ( spokesman_district.Spokesman_ID (INT), spokesman_district.District_ID (INT), spokesman_district.Start_year (TEXT), ) Possible JOINs: spokesman_district.Spokesman_ID = spokesman.Spokesman_ID spokesman_district.District_ID = district.District_ID
Table district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) Table spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) Table spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
CREATE TABLE district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) CREATE TABLE spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) CREATE TABLE spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
Table district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) Table spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) Table spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
CREATE TABLE district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) CREATE TABLE spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) CREATE TABLE spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
{ 'district': ['District_ID', 'Name', 'Area_km', 'Population', 'Density_km', 'Government_website'], 'spokesman': ['Spokesman_ID', 'Name', 'Age', 'Speach_title', 'Rank_position', 'Points'], 'spokesman_district': ['Spokesman_ID', 'District_ID', 'Start_year'] }
{ 'district': ['District_ID'], 'spokesman_district': ['Spokesman_ID', 'District_ID'] }
TABLE district ( district.District_ID (INT), district.Name (TEXT), district.Area_km (REAL), district.Population (REAL), district.Density_km (REAL), district.Government_website (TEXT), ) TABLE spokesman ( spokesman.Spokesman_ID (INT), spokesman.Name (TEXT), spokesman.Age (INT), spokesman.Speach_title (TEXT), spokesman.Rank_position (REAL), spokesman.Points (REAL), ) TABLE spokesman_district ( spokesman_district.Spokesman_ID (INT), spokesman_district.District_ID (INT), spokesman_district.Start_year (TEXT), ) Possible JOINs: spokesman_district.Spokesman_ID = spokesman.Spokesman_ID spokesman_district.District_ID = district.District_ID
TABLE district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) TABLE spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) TABLE spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
TABLE district ( district.district_id (INT), district.name (TEXT), district.area_km (REAL), district.population (REAL), district.density_km (REAL), district.government_website (TEXT), ) TABLE spokesman ( spokesman.spokesman_id (INT), spokesman.name (TEXT), spokesman.age (INT), spokesman.speach_title (TEXT), spokesman.rank_position (REAL), spokesman.points (REAL), ) TABLE spokesman_district ( spokesman_district.spokesman_id (INT), spokesman_district.district_id (INT), spokesman_district.start_year (TEXT), ) Possible JOINs: spokesman_district.spokesman_id = spokesman.spokesman_id spokesman_district.district_id = district.district_id
customers_and_orders
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_date DATETIME NOT NULL, order_status_code VARCHAR(15), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, address_id INTEGER NOT NULL, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(80), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE, PRIMARY KEY (product_id) )
What is the product id and product name for the cheapest Hardware type product?
hard
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
SELECT product_id , product_name FROM Products WHERE product_type_code = "Hardware" ORDER BY product_price ASC LIMIT 1
{ 'products': ['product_id', 'product_type_code', 'product_name', 'product_price'] }
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) Table customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) Table customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) Table products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
CREATE TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) CREATE TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) CREATE TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
{ 'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'], 'Addresses': ['address_id', 'address_details'], 'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'], 'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'], 'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity'] }
{ 'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'] }
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
online_exams
CREATE TABLE "Exams" ( "Exam_ID" INTEGER NOT NULL, "Subject_Code" CHAR(15) NOT NULL, "Exam_Date" DATETIME, "Exam_Name" VARCHAR(255), PRIMARY KEY ("Exam_ID") ) CREATE TABLE "Questions" ( "Question_ID" INTEGER NOT NULL, "Type_of_Question_Code" VARCHAR(15) NOT NULL, "Question_Text" VARCHAR(255), PRIMARY KEY ("Question_ID") ) CREATE TABLE "Questions_in_Exams" ( "Exam_ID" INTEGER NOT NULL, "Question_ID" INTEGER NOT NULL, PRIMARY KEY ("Exam_ID", "Question_ID"), FOREIGN KEY("Question_ID") REFERENCES "Questions" ("Question_ID"), FOREIGN KEY("Exam_ID") REFERENCES "Exams" ("Exam_ID") ) CREATE TABLE "Student_Answers" ( "Student_Answer_ID" INTEGER NOT NULL, "Exam_ID" INTEGER NOT NULL, "Question_ID" INTEGER NOT NULL, "Student_ID" INTEGER NOT NULL, "Date_of_Answer" DATETIME, "Comments" VARCHAR(255), "Satisfactory_YN" VARCHAR(1), "Student_Answer_Text" VARCHAR(255), PRIMARY KEY ("Student_Answer_ID"), FOREIGN KEY("Student_ID") REFERENCES "Students" ("Student_ID"), FOREIGN KEY("Exam_ID", "Question_ID") REFERENCES "Questions_in_Exams" ("Exam_ID", "Question_ID") ) CREATE TABLE "Student_Assessments" ( "Student_Answer_ID" VARCHAR(100) NOT NULL, "Valid_Answer_ID" INTEGER NOT NULL, "Student_Answer_Text" VARCHAR(255), "Satisfactory_YN" CHAR(1), "Assessment" VARCHAR(40), PRIMARY KEY ("Student_Answer_ID"), FOREIGN KEY("Valid_Answer_ID") REFERENCES "Valid_Answers" ("Valid_Answer_ID") ) CREATE TABLE "Students" ( "Student_ID" INTEGER NOT NULL, "First_Name" VARCHAR(255), "Middle_Name" VARCHAR(255), "Last_Name" VARCHAR(255), "Gender_MFU" CHAR(1), "Student_Address" VARCHAR(255), "Email_Adress" VARCHAR(255), "Cell_Mobile_Phone" VARCHAR(255), "Home_Phone" VARCHAR(255), PRIMARY KEY ("Student_ID") ) CREATE TABLE "Valid_Answers" ( "Valid_Answer_ID" INTEGER NOT NULL, "Question_ID" INTEGER NOT NULL, "Valid_Answer_Text" VARCHAR(255), PRIMARY KEY ("Valid_Answer_ID"), FOREIGN KEY("Question_ID") REFERENCES "Questions" ("Question_ID") )
List the first names of the students who do not have any answers.
hard
Table Exams ( Exams.Exam_ID (INTEGER), Exams.Subject_Code (CHAR(15)), Exams.Exam_Date (DATETIME), Exams.Exam_Name (VARCHAR(255)), ) Table Questions ( Questions.Question_ID (INTEGER), Questions.Type_of_Question_Code (VARCHAR(15)), Questions.Question_Text (VARCHAR(255)), ) Table Questions_in_Exams ( Questions_in_Exams.Exam_ID (INTEGER), Questions_in_Exams.Question_ID (INTEGER), ) Table Student_Answers ( Student_Answers.Student_Answer_ID (INTEGER), Student_Answers.Exam_ID (INTEGER), Student_Answers.Question_ID (INTEGER), Student_Answers.Student_ID (INTEGER), Student_Answers.Date_of_Answer (DATETIME), Student_Answers.Comments (VARCHAR(255)), Student_Answers.Satisfactory_YN (VARCHAR(1)), Student_Answers.Student_Answer_Text (VARCHAR(255)), ) Table Student_Assessments ( Student_Assessments.Student_Answer_ID (VARCHAR(100)), Student_Assessments.Valid_Answer_ID (INTEGER), Student_Assessments.Student_Answer_Text (VARCHAR(255)), Student_Assessments.Satisfactory_YN (CHAR(1)), Student_Assessments.Assessment (VARCHAR(40)), ) Table Students ( Students.Student_ID (INTEGER), Students.First_Name (VARCHAR(255)), Students.Middle_Name (VARCHAR(255)), Students.Last_Name (VARCHAR(255)), Students.Gender_MFU (CHAR(1)), Students.Student_Address (VARCHAR(255)), Students.Email_Adress (VARCHAR(255)), Students.Cell_Mobile_Phone (VARCHAR(255)), Students.Home_Phone (VARCHAR(255)), ) Table Valid_Answers ( Valid_Answers.Valid_Answer_ID (INTEGER), Valid_Answers.Question_ID (INTEGER), Valid_Answers.Valid_Answer_Text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.Exam_ID = Exams.Exam_ID Questions_in_Exams.Question_ID = Questions.Question_ID Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID Student_Answers.Question_ID = Questions_in_Exams.Question_ID Student_Answers.Student_ID = Students.Student_ID Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID Valid_Answers.Question_ID = Questions.Question_ID
SELECT First_Name FROM Students WHERE Student_ID NOT IN (SELECT Student_ID FROM Student_Answers)
{ 'students': ['student_id', 'first_name'], 'student_answers': ['student_answer_id', 'student_id'] }
CREATE TABLE Exams ( Exams.Exam_ID (INTEGER), Exams.Subject_Code (CHAR(15)), Exams.Exam_Date (DATETIME), Exams.Exam_Name (VARCHAR(255)), ) CREATE TABLE Questions ( Questions.Question_ID (INTEGER), Questions.Type_of_Question_Code (VARCHAR(15)), Questions.Question_Text (VARCHAR(255)), ) CREATE TABLE Questions_in_Exams ( Questions_in_Exams.Exam_ID (INTEGER), Questions_in_Exams.Question_ID (INTEGER), ) CREATE TABLE Student_Answers ( Student_Answers.Student_Answer_ID (INTEGER), Student_Answers.Exam_ID (INTEGER), Student_Answers.Question_ID (INTEGER), Student_Answers.Student_ID (INTEGER), Student_Answers.Date_of_Answer (DATETIME), Student_Answers.Comments (VARCHAR(255)), Student_Answers.Satisfactory_YN (VARCHAR(1)), Student_Answers.Student_Answer_Text (VARCHAR(255)), ) CREATE TABLE Student_Assessments ( Student_Assessments.Student_Answer_ID (VARCHAR(100)), Student_Assessments.Valid_Answer_ID (INTEGER), Student_Assessments.Student_Answer_Text (VARCHAR(255)), Student_Assessments.Satisfactory_YN (CHAR(1)), Student_Assessments.Assessment (VARCHAR(40)), ) CREATE TABLE Students ( Students.Student_ID (INTEGER), Students.First_Name (VARCHAR(255)), Students.Middle_Name (VARCHAR(255)), Students.Last_Name (VARCHAR(255)), Students.Gender_MFU (CHAR(1)), Students.Student_Address (VARCHAR(255)), Students.Email_Adress (VARCHAR(255)), Students.Cell_Mobile_Phone (VARCHAR(255)), Students.Home_Phone (VARCHAR(255)), ) CREATE TABLE Valid_Answers ( Valid_Answers.Valid_Answer_ID (INTEGER), Valid_Answers.Question_ID (INTEGER), Valid_Answers.Valid_Answer_Text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.Exam_ID = Exams.Exam_ID Questions_in_Exams.Question_ID = Questions.Question_ID Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID Student_Answers.Question_ID = Questions_in_Exams.Question_ID Student_Answers.Student_ID = Students.Student_ID Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID Valid_Answers.Question_ID = Questions.Question_ID
Table Exams ( Exams.exam_id (INTEGER), Exams.subject_code (CHAR(15)), Exams.exam_date (DATETIME), Exams.exam_name (VARCHAR(255)), ) Table Questions ( Questions.question_id (INTEGER), Questions.type_of_question_code (VARCHAR(15)), Questions.question_text (VARCHAR(255)), ) Table Questions_in_Exams ( Questions_in_Exams.exam_id (INTEGER), Questions_in_Exams.question_id (INTEGER), ) Table Student_Answers ( Student_Answers.student_answer_id (INTEGER), Student_Answers.exam_id (INTEGER), Student_Answers.question_id (INTEGER), Student_Answers.student_id (INTEGER), Student_Answers.date_of_answer (DATETIME), Student_Answers.comments (VARCHAR(255)), Student_Answers.satisfactory_yn (VARCHAR(1)), Student_Answers.student_answer_text (VARCHAR(255)), ) Table Student_Assessments ( Student_Assessments.student_answer_id (VARCHAR(100)), Student_Assessments.valid_answer_id (INTEGER), Student_Assessments.student_answer_text (VARCHAR(255)), Student_Assessments.satisfactory_yn (CHAR(1)), Student_Assessments.assessment (VARCHAR(40)), ) Table Students ( Students.student_id (INTEGER), Students.first_name (VARCHAR(255)), Students.middle_name (VARCHAR(255)), Students.last_name (VARCHAR(255)), Students.gender_mfu (CHAR(1)), Students.student_address (VARCHAR(255)), Students.email_adress (VARCHAR(255)), Students.cell_mobile_phone (VARCHAR(255)), Students.home_phone (VARCHAR(255)), ) Table Valid_Answers ( Valid_Answers.valid_answer_id (INTEGER), Valid_Answers.question_id (INTEGER), Valid_Answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.exam_id = Exams.exam_id Questions_in_Exams.question_id = Questions.question_id Student_Answers.exam_id = Questions_in_Exams.exam_id Student_Answers.question_id = Questions_in_Exams.question_id Student_Answers.student_id = Students.student_id Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id Valid_Answers.question_id = Questions.question_id
CREATE TABLE Exams ( Exams.exam_id (INTEGER), Exams.subject_code (CHAR(15)), Exams.exam_date (DATETIME), Exams.exam_name (VARCHAR(255)), ) CREATE TABLE Questions ( Questions.question_id (INTEGER), Questions.type_of_question_code (VARCHAR(15)), Questions.question_text (VARCHAR(255)), ) CREATE TABLE Questions_in_Exams ( Questions_in_Exams.exam_id (INTEGER), Questions_in_Exams.question_id (INTEGER), ) CREATE TABLE Student_Answers ( Student_Answers.student_answer_id (INTEGER), Student_Answers.exam_id (INTEGER), Student_Answers.question_id (INTEGER), Student_Answers.student_id (INTEGER), Student_Answers.date_of_answer (DATETIME), Student_Answers.comments (VARCHAR(255)), Student_Answers.satisfactory_yn (VARCHAR(1)), Student_Answers.student_answer_text (VARCHAR(255)), ) CREATE TABLE Student_Assessments ( Student_Assessments.student_answer_id (VARCHAR(100)), Student_Assessments.valid_answer_id (INTEGER), Student_Assessments.student_answer_text (VARCHAR(255)), Student_Assessments.satisfactory_yn (CHAR(1)), Student_Assessments.assessment (VARCHAR(40)), ) CREATE TABLE Students ( Students.student_id (INTEGER), Students.first_name (VARCHAR(255)), Students.middle_name (VARCHAR(255)), Students.last_name (VARCHAR(255)), Students.gender_mfu (CHAR(1)), Students.student_address (VARCHAR(255)), Students.email_adress (VARCHAR(255)), Students.cell_mobile_phone (VARCHAR(255)), Students.home_phone (VARCHAR(255)), ) CREATE TABLE Valid_Answers ( Valid_Answers.valid_answer_id (INTEGER), Valid_Answers.question_id (INTEGER), Valid_Answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.exam_id = Exams.exam_id Questions_in_Exams.question_id = Questions.question_id Student_Answers.exam_id = Questions_in_Exams.exam_id Student_Answers.question_id = Questions_in_Exams.question_id Student_Answers.student_id = Students.student_id Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id Valid_Answers.question_id = Questions.question_id
Table exams ( exams.exam_id (INTEGER), exams.subject_code (CHAR(15)), exams.exam_date (DATETIME), exams.exam_name (VARCHAR(255)), ) Table questions ( questions.question_id (INTEGER), questions.type_of_question_code (VARCHAR(15)), questions.question_text (VARCHAR(255)), ) Table questions_in_exams ( questions_in_exams.exam_id (INTEGER), questions_in_exams.question_id (INTEGER), ) Table student_answers ( student_answers.student_answer_id (INTEGER), student_answers.exam_id (INTEGER), student_answers.question_id (INTEGER), student_answers.student_id (INTEGER), student_answers.date_of_answer (DATETIME), student_answers.comments (VARCHAR(255)), student_answers.satisfactory_yn (VARCHAR(1)), student_answers.student_answer_text (VARCHAR(255)), ) Table student_assessments ( student_assessments.student_answer_id (VARCHAR(100)), student_assessments.valid_answer_id (INTEGER), student_assessments.student_answer_text (VARCHAR(255)), student_assessments.satisfactory_yn (CHAR(1)), student_assessments.assessment (VARCHAR(40)), ) Table students ( students.student_id (INTEGER), students.first_name (VARCHAR(255)), students.middle_name (VARCHAR(255)), students.last_name (VARCHAR(255)), students.gender_mfu (CHAR(1)), students.student_address (VARCHAR(255)), students.email_adress (VARCHAR(255)), students.cell_mobile_phone (VARCHAR(255)), students.home_phone (VARCHAR(255)), ) Table valid_answers ( valid_answers.valid_answer_id (INTEGER), valid_answers.question_id (INTEGER), valid_answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: questions_in_exams.exam_id = exams.exam_id questions_in_exams.question_id = questions.question_id student_answers.exam_id = questions_in_exams.exam_id student_answers.question_id = questions_in_exams.question_id student_answers.student_id = students.student_id student_assessments.valid_answer_id = valid_answers.valid_answer_id valid_answers.question_id = questions.question_id
CREATE TABLE exams ( exams.exam_id (INTEGER), exams.subject_code (CHAR(15)), exams.exam_date (DATETIME), exams.exam_name (VARCHAR(255)), ) CREATE TABLE questions ( questions.question_id (INTEGER), questions.type_of_question_code (VARCHAR(15)), questions.question_text (VARCHAR(255)), ) CREATE TABLE questions_in_exams ( questions_in_exams.exam_id (INTEGER), questions_in_exams.question_id (INTEGER), ) CREATE TABLE student_answers ( student_answers.student_answer_id (INTEGER), student_answers.exam_id (INTEGER), student_answers.question_id (INTEGER), student_answers.student_id (INTEGER), student_answers.date_of_answer (DATETIME), student_answers.comments (VARCHAR(255)), student_answers.satisfactory_yn (VARCHAR(1)), student_answers.student_answer_text (VARCHAR(255)), ) CREATE TABLE student_assessments ( student_assessments.student_answer_id (VARCHAR(100)), student_assessments.valid_answer_id (INTEGER), student_assessments.student_answer_text (VARCHAR(255)), student_assessments.satisfactory_yn (CHAR(1)), student_assessments.assessment (VARCHAR(40)), ) CREATE TABLE students ( students.student_id (INTEGER), students.first_name (VARCHAR(255)), students.middle_name (VARCHAR(255)), students.last_name (VARCHAR(255)), students.gender_mfu (CHAR(1)), students.student_address (VARCHAR(255)), students.email_adress (VARCHAR(255)), students.cell_mobile_phone (VARCHAR(255)), students.home_phone (VARCHAR(255)), ) CREATE TABLE valid_answers ( valid_answers.valid_answer_id (INTEGER), valid_answers.question_id (INTEGER), valid_answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: questions_in_exams.exam_id = exams.exam_id questions_in_exams.question_id = questions.question_id student_answers.exam_id = questions_in_exams.exam_id student_answers.question_id = questions_in_exams.question_id student_answers.student_id = students.student_id student_assessments.valid_answer_id = valid_answers.valid_answer_id valid_answers.question_id = questions.question_id
{ 'Students': ['Student_ID', 'First_Name', 'Middle_Name', 'Last_Name', 'Gender_MFU', 'Student_Address', 'Email_Adress', 'Cell_Mobile_Phone', 'Home_Phone'], 'Questions': ['Question_ID', 'Type_of_Question_Code', 'Question_Text'], 'Exams': ['Exam_ID', 'Subject_Code', 'Exam_Date', 'Exam_Name'], 'Questions_in_Exams': ['Exam_ID', 'Question_ID'], 'Valid_Answers': ['Valid_Answer_ID', 'Question_ID', 'Valid_Answer_Text'], 'Student_Answers': ['Student_Answer_ID', 'Exam_ID', 'Question_ID', 'Student_ID', 'Date_of_Answer', 'Comments', 'Satisfactory_YN', 'Student_Answer_Text'], 'Student_Assessments': ['Student_Answer_ID', 'Valid_Answer_ID', 'Student_Answer_Text', 'Satisfactory_YN', 'Assessment'] }
{ 'Students': ['Student_ID', 'First_Name'], 'Student_Answers': ['Student_Answer_ID', 'Student_ID'] }
TABLE Exams ( Exams.Exam_ID (INTEGER), Exams.Subject_Code (CHAR(15)), Exams.Exam_Date (DATETIME), Exams.Exam_Name (VARCHAR(255)), ) TABLE Questions ( Questions.Question_ID (INTEGER), Questions.Type_of_Question_Code (VARCHAR(15)), Questions.Question_Text (VARCHAR(255)), ) TABLE Questions_in_Exams ( Questions_in_Exams.Exam_ID (INTEGER), Questions_in_Exams.Question_ID (INTEGER), ) TABLE Student_Answers ( Student_Answers.Student_Answer_ID (INTEGER), Student_Answers.Exam_ID (INTEGER), Student_Answers.Question_ID (INTEGER), Student_Answers.Student_ID (INTEGER), Student_Answers.Date_of_Answer (DATETIME), Student_Answers.Comments (VARCHAR(255)), Student_Answers.Satisfactory_YN (VARCHAR(1)), Student_Answers.Student_Answer_Text (VARCHAR(255)), ) TABLE Student_Assessments ( Student_Assessments.Student_Answer_ID (VARCHAR(100)), Student_Assessments.Valid_Answer_ID (INTEGER), Student_Assessments.Student_Answer_Text (VARCHAR(255)), Student_Assessments.Satisfactory_YN (CHAR(1)), Student_Assessments.Assessment (VARCHAR(40)), ) TABLE Students ( Students.Student_ID (INTEGER), Students.First_Name (VARCHAR(255)), Students.Middle_Name (VARCHAR(255)), Students.Last_Name (VARCHAR(255)), Students.Gender_MFU (CHAR(1)), Students.Student_Address (VARCHAR(255)), Students.Email_Adress (VARCHAR(255)), Students.Cell_Mobile_Phone (VARCHAR(255)), Students.Home_Phone (VARCHAR(255)), ) TABLE Valid_Answers ( Valid_Answers.Valid_Answer_ID (INTEGER), Valid_Answers.Question_ID (INTEGER), Valid_Answers.Valid_Answer_Text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.Exam_ID = Exams.Exam_ID Questions_in_Exams.Question_ID = Questions.Question_ID Student_Answers.Exam_ID = Questions_in_Exams.Exam_ID Student_Answers.Question_ID = Questions_in_Exams.Question_ID Student_Answers.Student_ID = Students.Student_ID Student_Assessments.Valid_Answer_ID = Valid_Answers.Valid_Answer_ID Valid_Answers.Question_ID = Questions.Question_ID
TABLE Exams ( Exams.exam_id (INTEGER), Exams.subject_code (CHAR(15)), Exams.exam_date (DATETIME), Exams.exam_name (VARCHAR(255)), ) TABLE Questions ( Questions.question_id (INTEGER), Questions.type_of_question_code (VARCHAR(15)), Questions.question_text (VARCHAR(255)), ) TABLE Questions_in_Exams ( Questions_in_Exams.exam_id (INTEGER), Questions_in_Exams.question_id (INTEGER), ) TABLE Student_Answers ( Student_Answers.student_answer_id (INTEGER), Student_Answers.exam_id (INTEGER), Student_Answers.question_id (INTEGER), Student_Answers.student_id (INTEGER), Student_Answers.date_of_answer (DATETIME), Student_Answers.comments (VARCHAR(255)), Student_Answers.satisfactory_yn (VARCHAR(1)), Student_Answers.student_answer_text (VARCHAR(255)), ) TABLE Student_Assessments ( Student_Assessments.student_answer_id (VARCHAR(100)), Student_Assessments.valid_answer_id (INTEGER), Student_Assessments.student_answer_text (VARCHAR(255)), Student_Assessments.satisfactory_yn (CHAR(1)), Student_Assessments.assessment (VARCHAR(40)), ) TABLE Students ( Students.student_id (INTEGER), Students.first_name (VARCHAR(255)), Students.middle_name (VARCHAR(255)), Students.last_name (VARCHAR(255)), Students.gender_mfu (CHAR(1)), Students.student_address (VARCHAR(255)), Students.email_adress (VARCHAR(255)), Students.cell_mobile_phone (VARCHAR(255)), Students.home_phone (VARCHAR(255)), ) TABLE Valid_Answers ( Valid_Answers.valid_answer_id (INTEGER), Valid_Answers.question_id (INTEGER), Valid_Answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: Questions_in_Exams.exam_id = Exams.exam_id Questions_in_Exams.question_id = Questions.question_id Student_Answers.exam_id = Questions_in_Exams.exam_id Student_Answers.question_id = Questions_in_Exams.question_id Student_Answers.student_id = Students.student_id Student_Assessments.valid_answer_id = Valid_Answers.valid_answer_id Valid_Answers.question_id = Questions.question_id
TABLE exams ( exams.exam_id (INTEGER), exams.subject_code (CHAR(15)), exams.exam_date (DATETIME), exams.exam_name (VARCHAR(255)), ) TABLE questions ( questions.question_id (INTEGER), questions.type_of_question_code (VARCHAR(15)), questions.question_text (VARCHAR(255)), ) TABLE questions_in_exams ( questions_in_exams.exam_id (INTEGER), questions_in_exams.question_id (INTEGER), ) TABLE student_answers ( student_answers.student_answer_id (INTEGER), student_answers.exam_id (INTEGER), student_answers.question_id (INTEGER), student_answers.student_id (INTEGER), student_answers.date_of_answer (DATETIME), student_answers.comments (VARCHAR(255)), student_answers.satisfactory_yn (VARCHAR(1)), student_answers.student_answer_text (VARCHAR(255)), ) TABLE student_assessments ( student_assessments.student_answer_id (VARCHAR(100)), student_assessments.valid_answer_id (INTEGER), student_assessments.student_answer_text (VARCHAR(255)), student_assessments.satisfactory_yn (CHAR(1)), student_assessments.assessment (VARCHAR(40)), ) TABLE students ( students.student_id (INTEGER), students.first_name (VARCHAR(255)), students.middle_name (VARCHAR(255)), students.last_name (VARCHAR(255)), students.gender_mfu (CHAR(1)), students.student_address (VARCHAR(255)), students.email_adress (VARCHAR(255)), students.cell_mobile_phone (VARCHAR(255)), students.home_phone (VARCHAR(255)), ) TABLE valid_answers ( valid_answers.valid_answer_id (INTEGER), valid_answers.question_id (INTEGER), valid_answers.valid_answer_text (VARCHAR(255)), ) Possible JOINs: questions_in_exams.exam_id = exams.exam_id questions_in_exams.question_id = questions.question_id student_answers.exam_id = questions_in_exams.exam_id student_answers.question_id = questions_in_exams.question_id student_answers.student_id = students.student_id student_assessments.valid_answer_id = valid_answers.valid_answer_id valid_answers.question_id = questions.question_id
cre_Doc_and_collections
CREATE TABLE "Collection_Subset_Members" ( "Collection_ID" INTEGER NOT NULL, "Related_Collection_ID" INTEGER NOT NULL, "Collection_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Collection_ID", "Related_Collection_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Related_Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Collection_Subset_ID") REFERENCES "Collection_Subsets" ("Collection_Subset_ID") ) CREATE TABLE "Collection_Subsets" ( "Collection_Subset_ID" INTEGER NOT NULL, "Collection_Subset_Name" VARCHAR(255) NOT NULL, "Collecrtion_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Collection_Subset_ID") ) CREATE TABLE "Collections" ( "Collection_ID" INTEGER NOT NULL, "Parent_Collection_ID" INTEGER, "Collection_Name" VARCHAR(255), "Collection_Description" VARCHAR(255), PRIMARY KEY ("Collection_ID") ) CREATE TABLE "Document_Objects" ( "Document_Object_ID" INTEGER NOT NULL, "Parent_Document_Object_ID" INTEGER, "Owner" VARCHAR(255), "Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_Object_ID") ) CREATE TABLE "Document_Subset_Members" ( "Document_Object_ID" INTEGER NOT NULL, "Related_Document_Object_ID" INTEGER NOT NULL, "Document_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Related_Document_Object_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Document_Subset_ID") REFERENCES "Document_Subsets" ("Document_Subset_ID"), FOREIGN KEY("Related_Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID") ) CREATE TABLE "Document_Subsets" ( "Document_Subset_ID" INTEGER NOT NULL, "Document_Subset_Name" VARCHAR(255) NOT NULL, "Document_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Subset_ID") ) CREATE TABLE "Documents_in_Collections" ( "Document_Object_ID" INTEGER NOT NULL, "Collection_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Collection_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID") )
List all document subsets of documents that related to each document id. List the name of document subset and the document id.
medium
Table Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) Table Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) Table Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
SELECT DISTINCT Document_Subsets.Document_Subset_Name , Document_Subset_Members.Document_Object_ID FROM Document_Subset_Members JOIN Document_Subset_Members ON Document_Subset_Members.Related_Document_Object_ID = Document_Subset_Members.Document_Object_ID JOIN Document_Subsets ON Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID
{ 'document_subset_members': ['document_object_id', 'related_document_object_id', 'document_subset_id'], 'document_subsets': ['document_subset_id', 'document_subset_name'] }
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
Table Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) Table Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) Table Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
Table collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) Table collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) Table collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) Table document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) Table document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) Table document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) Table documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
CREATE TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) CREATE TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) CREATE TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) CREATE TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) CREATE TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
{ 'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name', 'Document_Subset_Details'], 'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name', 'Collecrtion_Subset_Details'], 'Document_Objects': ['Document_Object_ID', 'Parent_Document_Object_ID', 'Owner', 'Description', 'Other_Details'], 'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name', 'Collection_Description'], 'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'], 'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'], 'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID', 'Collection_Subset_ID'] }
{ 'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'], 'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name'] }
TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
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") )
Find the first and last name of artists who have painting but no sculpture work.
extra
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 artists.lname , artists.fname FROM artists JOIN paintings ON artists.artistID = paintings.painterID EXCEPT SELECT artists.lname , artists.fname FROM artists JOIN sculptures ON artists.artistID = sculptures.sculptorID
{ 'artists': ['artistid', 'lname', 'fname'], 'paintings': ['paintingid', 'painterid'], 'sculptures': ['sculptureid', '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', 'lname', 'fname'], 'Paintings': ['paintingID', 'painterID'], 'Sculptures': ['sculptureID', '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
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") )
What are the three dates for which the most receipts were given?
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 date FROM receipts GROUP BY date ORDER BY count(*) DESC LIMIT 3
{ 'receipts': ['receiptnumber', 'date'] }
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'] }
{ 'receipts': ['ReceiptNumber', 'Date'] }
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
headphone_store
CREATE TABLE headphone ( "Headphone_ID" INTEGER, "Model" TEXT, "Class" TEXT, "Driver-matched_dB" REAL, "Construction" TEXT, "Earpads" TEXT, "Price" INTEGER, PRIMARY KEY ("Headphone_ID") ) CREATE TABLE stock ( "Store_ID" INTEGER, "Headphone_ID" INTEGER, "Quantity" INTEGER, PRIMARY KEY ("Store_ID", "Headphone_ID"), FOREIGN KEY("Headphone_ID") REFERENCES headphone ("Headphone_ID"), FOREIGN KEY("Store_ID") REFERENCES store ("Store_ID") ) CREATE TABLE store ( "Store_ID" INTEGER, "Name" TEXT, "Neighborhood" TEXT, "Parking" TEXT, "Date_Opened" TEXT, PRIMARY KEY ("Store_ID") )
Find the top 2 earpads that are mostly used.
hard
Table headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) Table stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) Table store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
SELECT earpads FROM headphone GROUP BY earpads ORDER BY count(*) DESC LIMIT 2
{ 'headphone': ['headphone_id', 'earpads'] }
CREATE TABLE headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) CREATE TABLE stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) CREATE TABLE store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
Table headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) Table stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) Table store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
CREATE TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) CREATE TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) CREATE TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
Table headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) Table stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) Table store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
CREATE TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) CREATE TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) CREATE TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
{ 'headphone': ['Headphone_ID', 'Model', 'Class', 'Driver-matched_dB', 'Construction', 'Earpads', 'Price'], 'store': ['Store_ID', 'Name', 'Neighborhood', 'Parking', 'Date_Opened'], 'stock': ['Store_ID', 'Headphone_ID', 'Quantity'] }
{ 'headphone': ['Headphone_ID', 'Earpads'] }
TABLE headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) TABLE stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) TABLE store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_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 */
What are the pairs of teachers and students who are in the same class? Give me the pairs of their details.
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
bbc_channels
CREATE TABLE channel ( "Channel_ID" INTEGER, "Name" TEXT, "Analogue_terrestrial_channel" TEXT, "Digital_terrestrial_channel" TEXT, "Internet" TEXT, PRIMARY KEY ("Channel_ID") ) CREATE TABLE director ( "Director_ID" INTEGER, "Name" TEXT, "Age" INTEGER, PRIMARY KEY ("Director_ID") ) CREATE TABLE director_admin ( "Director_ID" INTEGER, "Channel_ID" INTEGER, "Is_first_director" BOOLEAN, PRIMARY KEY ("Director_ID", "Channel_ID"), FOREIGN KEY("Director_ID") REFERENCES director ("Director_ID"), FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID") ) CREATE TABLE program ( "Program_ID" INTEGER, "Start_Year" REAL, "Title" TEXT, "Director_ID" INTEGER, "Channel_ID" INTEGER, PRIMARY KEY ("Program_ID"), FOREIGN KEY("Director_ID") REFERENCES director ("Director_ID"), FOREIGN KEY("Channel_ID") REFERENCES channel ("Channel_ID") )
Find the id and name of the channel that is not directed by Hank Baskett.
hard
Table channel ( channel.Channel_ID (INT), channel.Name (TEXT), channel.Analogue_terrestrial_channel (TEXT), channel.Digital_terrestrial_channel (TEXT), channel.Internet (TEXT), ) Table director ( director.Director_ID (INT), director.Name (TEXT), director.Age (INT), ) Table director_admin ( director_admin.Director_ID (INT), director_admin.Channel_ID (INT), director_admin.Is_first_director (bool), ) Table program ( program.Program_ID (INT), program.Start_Year (REAL), program.Title (TEXT), program.Director_ID (INT), program.Channel_ID (INT), ) Possible JOINs: director_admin.Director_ID = director.Director_ID director_admin.Channel_ID = channel.Channel_ID program.Director_ID = director.Director_ID program.Channel_ID = channel.Channel_ID
SELECT channel.name , channel.channel_id FROM channel JOIN director_admin ON channel.channel_id = director_admin.channel_id JOIN director ON director_admin.director_id = director.director_id WHERE director.name != "Hank Baskett"
{ 'channel': ['channel_id', 'name'], 'director_admin': ['director_id', 'channel_id'], 'director': ['director_id', 'name'] }
CREATE TABLE channel ( channel.Channel_ID (INT), channel.Name (TEXT), channel.Analogue_terrestrial_channel (TEXT), channel.Digital_terrestrial_channel (TEXT), channel.Internet (TEXT), ) CREATE TABLE director ( director.Director_ID (INT), director.Name (TEXT), director.Age (INT), ) CREATE TABLE director_admin ( director_admin.Director_ID (INT), director_admin.Channel_ID (INT), director_admin.Is_first_director (bool), ) CREATE TABLE program ( program.Program_ID (INT), program.Start_Year (REAL), program.Title (TEXT), program.Director_ID (INT), program.Channel_ID (INT), ) Possible JOINs: director_admin.Director_ID = director.Director_ID director_admin.Channel_ID = channel.Channel_ID program.Director_ID = director.Director_ID program.Channel_ID = channel.Channel_ID
Table channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) Table director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) Table director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) Table program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
CREATE TABLE channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) CREATE TABLE director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) CREATE TABLE director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) CREATE TABLE program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
Table channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) Table director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) Table director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) Table program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
CREATE TABLE channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) CREATE TABLE director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) CREATE TABLE director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) CREATE TABLE program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
{ 'channel': ['Channel_ID', 'Name', 'Analogue_terrestrial_channel', 'Digital_terrestrial_channel', 'Internet'], 'director': ['Director_ID', 'Name', 'Age'], 'program': ['Program_ID', 'Start_Year', 'Title', 'Director_ID', 'Channel_ID'], 'director_admin': ['Director_ID', 'Channel_ID', 'Is_first_director'] }
{ 'channel': ['Channel_ID', 'Name'], 'director_admin': ['Director_ID', 'Channel_ID'], 'director': ['Director_ID', 'Name'] }
TABLE channel ( channel.Channel_ID (INT), channel.Name (TEXT), channel.Analogue_terrestrial_channel (TEXT), channel.Digital_terrestrial_channel (TEXT), channel.Internet (TEXT), ) TABLE director ( director.Director_ID (INT), director.Name (TEXT), director.Age (INT), ) TABLE director_admin ( director_admin.Director_ID (INT), director_admin.Channel_ID (INT), director_admin.Is_first_director (bool), ) TABLE program ( program.Program_ID (INT), program.Start_Year (REAL), program.Title (TEXT), program.Director_ID (INT), program.Channel_ID (INT), ) Possible JOINs: director_admin.Director_ID = director.Director_ID director_admin.Channel_ID = channel.Channel_ID program.Director_ID = director.Director_ID program.Channel_ID = channel.Channel_ID
TABLE channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) TABLE director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) TABLE director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) TABLE program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
TABLE channel ( channel.channel_id (INT), channel.name (TEXT), channel.analogue_terrestrial_channel (TEXT), channel.digital_terrestrial_channel (TEXT), channel.internet (TEXT), ) TABLE director ( director.director_id (INT), director.name (TEXT), director.age (INT), ) TABLE director_admin ( director_admin.director_id (INT), director_admin.channel_id (INT), director_admin.is_first_director (bool), ) TABLE program ( program.program_id (INT), program.start_year (REAL), program.title (TEXT), program.director_id (INT), program.channel_id (INT), ) Possible JOINs: director_admin.director_id = director.director_id director_admin.channel_id = channel.channel_id program.director_id = director.director_id program.channel_id = channel.channel_id
book_1
CREATE TABLE Client (IdClient CHAR(10) PRIMARY KEY, Name VARCHAR(25) NOT NULL, Address VARCHAR(60) NOT NULL, NumCC CHAR(16) NOT NULL) /* 0 rows from Client table: IdClient Name Address NumCC */ CREATE TABLE Orders (IdOrder CHAR(10) PRIMARY KEY, IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade, DateOrder DATE, DateExped DATE) /* 0 rows from Orders table: IdOrder IdClient DateOrder DateExped */ CREATE TABLE Author ( idAuthor NUMBER PRIMARY KEY, Name VARCHAR(25)) /* 0 rows from Author table: idAuthor Name */ CREATE TABLE Book (ISBN CHAR(15) PRIMARY KEY, Title VARCHAR(60) NOT NULL, Author CHAR(4) NOT NULL, PurchasePrice NUMBER(6,2) DEFAULT 0, SalePrice NUMBER(6,2) DEFAULT 0) /* 0 rows from Book table: ISBN Title Author PurchasePrice SalePrice */ CREATE TABLE Author_Book (ISBN CHAR(15), Author NUMBER, CONSTRAINT al_PK PRIMARY KEY (ISBN, Author), CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade, CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA)) /* 0 rows from Author_Book table: ISBN Author */ CREATE TABLE Books_Order( ISBN CHAR(15), IdOrder CHAR(10), amount NUMBER(3) CHECK (amount >0), CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder), CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade, CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade) /* 0 rows from Books_Order table: ISBN IdOrder amount */
Give the name of the author who wrote the book titled Pride and Prejudice.
hard
Table Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) Table Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) Table Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) Table Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) Table Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) Table Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
SELECT Author.name FROM Book JOIN Author_book ON Book.isbn = Author_book.isbn JOIN Author ON Author_book.Author = Author.idAuthor WHERE Book.title = "Pride and Prejudice"
{ 'book': ['isbn', 'title', 'author'], 'author_book': ['isbn', 'author'], 'author': ['idauthor', 'name'] }
CREATE TABLE Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) CREATE TABLE Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) CREATE TABLE Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) CREATE TABLE Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) CREATE TABLE Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) CREATE TABLE Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
Table Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) Table Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) Table Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) Table Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) Table Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) Table Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
CREATE TABLE Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) CREATE TABLE Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) CREATE TABLE Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) CREATE TABLE Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) CREATE TABLE Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) CREATE TABLE Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
Table author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) Table author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) Table book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) Table books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) Table client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) Table orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
CREATE TABLE author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) CREATE TABLE author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) CREATE TABLE book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) CREATE TABLE books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) CREATE TABLE client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) CREATE TABLE orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
{ 'Client': ['IdClient', 'Name', 'Address', 'NumCC'], 'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'], 'Author': ['idAuthor', 'Name'], 'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'], 'Author_Book': ['ISBN', 'Author'], 'Books_Order': ['ISBN', 'IdOrder', 'amount'] }
{ 'Book': ['ISBN', 'Title', 'Author'], 'Author_Book': ['ISBN', 'Author'], 'Author': ['idAuthor', 'Name'] }
TABLE Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) TABLE Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) TABLE Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) TABLE Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) TABLE Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) TABLE Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
TABLE Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) TABLE Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) TABLE Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) TABLE Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) TABLE Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) TABLE Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
TABLE author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) TABLE author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) TABLE book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) TABLE books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) TABLE client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) TABLE orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
pilot_1
CREATE TABLE "Hangar" ( plane_name CHAR(15) NOT NULL, location CHAR(15), PRIMARY KEY (plane_name) ) CREATE TABLE "PilotSkills" ( pilot_name CHAR(15) NOT NULL, plane_name CHAR(15) NOT NULL, age INTEGER, PRIMARY KEY (pilot_name, plane_name), FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name) )
What are the different plane names, ordered alphabetically?
easy
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
SELECT DISTINCT plane_name FROM pilotskills ORDER BY plane_name
{ 'pilotskills': ['pilot_name', 'plane_name'] }
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) Table pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
CREATE TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) CREATE TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
{ 'PilotSkills': ['pilot_name', 'plane_name', 'age'], 'Hangar': ['plane_name', 'location'] }
{ 'PilotSkills': ['pilot_name', 'plane_name'] }
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
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 mediums were used for the painting with id 80 ?
easy
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 medium FROM paintings WHERE paintingid = 80
{ 'paintings': ['paintingid', 'medium'] }
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'] }
{ 'Paintings': ['paintingID', '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
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
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 id of the artist with the most paintings before 1900?
extra
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 artists.artistID FROM artists JOIN paintings ON artists.artistID = paintings.painterID WHERE paintings.year < 1900 GROUP BY artists.artistID ORDER BY count(*) DESC LIMIT 1
{ 'artists': ['artistid'], 'paintings': ['paintingid', 'year', 'painterid'] }
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'], 'Paintings': ['paintingID', 'year', 'painterID'] }
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
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 are the average height and width of paintings grouped by painters and ordered by name?
extra
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 avg(height_mm) , avg(width_mm) , painterID FROM paintings GROUP BY painterID ORDER BY title
{ 'paintings': ['paintingid', 'title', 'height_mm', 'width_mm', 'painterid'] }
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'] }
{ 'Paintings': ['paintingID', 'title', 'height_mm', 'width_mm', 'painterID'] }
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
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") )
What is the name, city, and state of the university with number 1 ranked Accounting major?
hard
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 University.university_name , University.city , University.state FROM Major_Ranking JOIN University JOIN Major ON Major_Ranking.university_id = University.university_id AND Major_Ranking.major_id = Major.major_id WHERE Major_Ranking.rank = 1 AND Major.major_name = 'Accounting'
{ 'major_ranking': ['rank', 'university_id', 'major_id'], 'university': ['university_id', 'university_name', 'city', 'state'], 'major': ['major_id', 'major_name'] }
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'] }
{ 'major_ranking': ['Rank', 'University_ID', 'Major_ID'], 'university': ['University_ID', 'University_Name', 'City', 'State'], 'major': ['Major_ID', 'Major_Name'] }
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
vehicle_rent
CREATE TABLE "Customers" ( id INTEGER, name TEXT, age INTEGER, membership_credit INTEGER, PRIMARY KEY (id) ) CREATE TABLE "Discount" ( id INTEGER, name TEXT, membership_credit INTEGER, PRIMARY KEY (id) ) CREATE TABLE "Renting_history" ( id INTEGER, customer_id INTEGER, discount_id INTEGER, vehicles_id INTEGER, total_hours INTEGER, PRIMARY KEY (id), FOREIGN KEY(customer_id) REFERENCES "Customers" (id), FOREIGN KEY(vehicles_id) REFERENCES "Vehicles" (id), FOREIGN KEY(discount_id) REFERENCES "Discount" (id) ) CREATE TABLE "Vehicles" ( id INTEGER, name TEXT, "Model_year" INTEGER, "Type_of_powertrain" TEXT, "Combined_fuel_economy_rate" INTEGER, "City_fuel_economy_rate" INTEGER, "Highway_fuel_economy_rate" INTEGER, "Cost_per_25_miles" REAL, "Annual_fuel_cost" REAL, "Notes" TEXT, PRIMARY KEY (id) )
What is the average age for customers with a membership credit above the average?
hard
Table Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) Table Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) Table Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) Table Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.Model_year (INT), Vehicles.Type_of_powertrain (TEXT), Vehicles.Combined_fuel_economy_rate (INT), Vehicles.City_fuel_economy_rate (INT), Vehicles.Highway_fuel_economy_rate (INT), Vehicles.Cost_per_25_miles (REAL), Vehicles.Annual_fuel_cost (REAL), Vehicles.Notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
SELECT avg(age) FROM customers WHERE membership_credit > (SELECT avg(membership_credit) FROM customers)
{ 'customers': ['id', 'age', 'membership_credit'] }
CREATE TABLE Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) CREATE TABLE Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) CREATE TABLE Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) CREATE TABLE Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.Model_year (INT), Vehicles.Type_of_powertrain (TEXT), Vehicles.Combined_fuel_economy_rate (INT), Vehicles.City_fuel_economy_rate (INT), Vehicles.Highway_fuel_economy_rate (INT), Vehicles.Cost_per_25_miles (REAL), Vehicles.Annual_fuel_cost (REAL), Vehicles.Notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
Table Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) Table Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) Table Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) Table Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.model_year (INT), Vehicles.type_of_powertrain (TEXT), Vehicles.combined_fuel_economy_rate (INT), Vehicles.city_fuel_economy_rate (INT), Vehicles.highway_fuel_economy_rate (INT), Vehicles.cost_per_25_miles (REAL), Vehicles.annual_fuel_cost (REAL), Vehicles.notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
CREATE TABLE Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) CREATE TABLE Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) CREATE TABLE Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) CREATE TABLE Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.model_year (INT), Vehicles.type_of_powertrain (TEXT), Vehicles.combined_fuel_economy_rate (INT), Vehicles.city_fuel_economy_rate (INT), Vehicles.highway_fuel_economy_rate (INT), Vehicles.cost_per_25_miles (REAL), Vehicles.annual_fuel_cost (REAL), Vehicles.notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
Table customers ( customers.id (INT), customers.name (TEXT), customers.age (INT), customers.membership_credit (INT), ) Table discount ( discount.id (INT), discount.name (TEXT), discount.membership_credit (INT), ) Table renting_history ( renting_history.id (INT), renting_history.customer_id (INT), renting_history.discount_id (INT), renting_history.vehicles_id (INT), renting_history.total_hours (INT), ) Table vehicles ( vehicles.id (INT), vehicles.name (TEXT), vehicles.model_year (INT), vehicles.type_of_powertrain (TEXT), vehicles.combined_fuel_economy_rate (INT), vehicles.city_fuel_economy_rate (INT), vehicles.highway_fuel_economy_rate (INT), vehicles.cost_per_25_miles (REAL), vehicles.annual_fuel_cost (REAL), vehicles.notes (TEXT), ) Possible JOINs: renting_history.customer_id = customers.id renting_history.discount_id = discount.id renting_history.vehicles_id = vehicles.id
CREATE TABLE customers ( customers.id (INT), customers.name (TEXT), customers.age (INT), customers.membership_credit (INT), ) CREATE TABLE discount ( discount.id (INT), discount.name (TEXT), discount.membership_credit (INT), ) CREATE TABLE renting_history ( renting_history.id (INT), renting_history.customer_id (INT), renting_history.discount_id (INT), renting_history.vehicles_id (INT), renting_history.total_hours (INT), ) CREATE TABLE vehicles ( vehicles.id (INT), vehicles.name (TEXT), vehicles.model_year (INT), vehicles.type_of_powertrain (TEXT), vehicles.combined_fuel_economy_rate (INT), vehicles.city_fuel_economy_rate (INT), vehicles.highway_fuel_economy_rate (INT), vehicles.cost_per_25_miles (REAL), vehicles.annual_fuel_cost (REAL), vehicles.notes (TEXT), ) Possible JOINs: renting_history.customer_id = customers.id renting_history.discount_id = discount.id renting_history.vehicles_id = vehicles.id
{ 'Customers': ['id', 'name', 'age', 'membership_credit'], 'Discount': ['id', 'name', 'membership_credit'], 'Vehicles': ['id', 'name', 'Model_year', 'Type_of_powertrain', 'Combined_fuel_economy_rate', 'City_fuel_economy_rate', 'Highway_fuel_economy_rate', 'Cost_per_25_miles', 'Annual_fuel_cost', 'Notes'], 'Renting_history': ['id', 'customer_id', 'discount_id', 'vehicles_id', 'total_hours'] }
{ 'Customers': ['id', 'age', 'membership_credit'] }
TABLE Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) TABLE Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) TABLE Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) TABLE Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.Model_year (INT), Vehicles.Type_of_powertrain (TEXT), Vehicles.Combined_fuel_economy_rate (INT), Vehicles.City_fuel_economy_rate (INT), Vehicles.Highway_fuel_economy_rate (INT), Vehicles.Cost_per_25_miles (REAL), Vehicles.Annual_fuel_cost (REAL), Vehicles.Notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
TABLE Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) TABLE Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) TABLE Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) TABLE Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.model_year (INT), Vehicles.type_of_powertrain (TEXT), Vehicles.combined_fuel_economy_rate (INT), Vehicles.city_fuel_economy_rate (INT), Vehicles.highway_fuel_economy_rate (INT), Vehicles.cost_per_25_miles (REAL), Vehicles.annual_fuel_cost (REAL), Vehicles.notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
TABLE customers ( customers.id (INT), customers.name (TEXT), customers.age (INT), customers.membership_credit (INT), ) TABLE discount ( discount.id (INT), discount.name (TEXT), discount.membership_credit (INT), ) TABLE renting_history ( renting_history.id (INT), renting_history.customer_id (INT), renting_history.discount_id (INT), renting_history.vehicles_id (INT), renting_history.total_hours (INT), ) TABLE vehicles ( vehicles.id (INT), vehicles.name (TEXT), vehicles.model_year (INT), vehicles.type_of_powertrain (TEXT), vehicles.combined_fuel_economy_rate (INT), vehicles.city_fuel_economy_rate (INT), vehicles.highway_fuel_economy_rate (INT), vehicles.cost_per_25_miles (REAL), vehicles.annual_fuel_cost (REAL), vehicles.notes (TEXT), ) Possible JOINs: renting_history.customer_id = customers.id renting_history.discount_id = discount.id renting_history.vehicles_id = vehicles.id
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") )
Find the number of different locations where Rocks are stored.
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 count(DISTINCT LOCATION) FROM boxes JOIN warehouses ON boxes.warehouse = warehouses.code WHERE boxes.contents = 'Rocks'
{ 'boxes': ['code', 'contents', 'warehouse'], 'warehouses': ['code', 'location'] }
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'], 'Warehouses': ['Code', 'Location'] }
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
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") )
Find the name of the movie that is played in the most number of theaters.
extra
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 movies.title FROM movies JOIN movietheaters ON movies.code = movietheaters.movie GROUP BY movies.title ORDER BY count(*) DESC LIMIT 1
{ 'movies': ['code', 'title'], 'movietheaters': ['code', 'movie'] }
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'], 'MovieTheaters': ['Code', 'Movie'] }
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
book_1
CREATE TABLE Client (IdClient CHAR(10) PRIMARY KEY, Name VARCHAR(25) NOT NULL, Address VARCHAR(60) NOT NULL, NumCC CHAR(16) NOT NULL) /* 0 rows from Client table: IdClient Name Address NumCC */ CREATE TABLE Orders (IdOrder CHAR(10) PRIMARY KEY, IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade, DateOrder DATE, DateExped DATE) /* 0 rows from Orders table: IdOrder IdClient DateOrder DateExped */ CREATE TABLE Author ( idAuthor NUMBER PRIMARY KEY, Name VARCHAR(25)) /* 0 rows from Author table: idAuthor Name */ CREATE TABLE Book (ISBN CHAR(15) PRIMARY KEY, Title VARCHAR(60) NOT NULL, Author CHAR(4) NOT NULL, PurchasePrice NUMBER(6,2) DEFAULT 0, SalePrice NUMBER(6,2) DEFAULT 0) /* 0 rows from Book table: ISBN Title Author PurchasePrice SalePrice */ CREATE TABLE Author_Book (ISBN CHAR(15), Author NUMBER, CONSTRAINT al_PK PRIMARY KEY (ISBN, Author), CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade, CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA)) /* 0 rows from Author_Book table: ISBN Author */ CREATE TABLE Books_Order( ISBN CHAR(15), IdOrder CHAR(10), amount NUMBER(3) CHECK (amount >0), CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder), CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade, CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade) /* 0 rows from Books_Order table: ISBN IdOrder amount */
What is the average sale price of books written by George Orwell?
hard
Table Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) Table Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) Table Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) Table Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) Table Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) Table Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
SELECT avg(saleprice) FROM Book JOIN Author_book ON Book.isbn = Author_book.isbn JOIN Author ON Author_book.Author = Author.idAuthor WHERE Author.name = "George Orwell"
{ 'book': ['isbn', 'author', 'saleprice'], 'author_book': ['isbn', 'author'], 'author': ['idauthor', 'name'] }
CREATE TABLE Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) CREATE TABLE Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) CREATE TABLE Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) CREATE TABLE Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) CREATE TABLE Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) CREATE TABLE Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
Table Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) Table Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) Table Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) Table Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) Table Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) Table Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
CREATE TABLE Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) CREATE TABLE Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) CREATE TABLE Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) CREATE TABLE Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) CREATE TABLE Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) CREATE TABLE Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
Table author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) Table author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) Table book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) Table books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) Table client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) Table orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
CREATE TABLE author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) CREATE TABLE author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) CREATE TABLE book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) CREATE TABLE books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) CREATE TABLE client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) CREATE TABLE orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
{ 'Client': ['IdClient', 'Name', 'Address', 'NumCC'], 'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'], 'Author': ['idAuthor', 'Name'], 'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'], 'Author_Book': ['ISBN', 'Author'], 'Books_Order': ['ISBN', 'IdOrder', 'amount'] }
{ 'Book': ['ISBN', 'Author', 'SalePrice'], 'Author_Book': ['ISBN', 'Author'], 'Author': ['idAuthor', 'Name'] }
TABLE Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) TABLE Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) TABLE Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) TABLE Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) TABLE Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) TABLE Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
TABLE Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) TABLE Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) TABLE Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) TABLE Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) TABLE Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) TABLE Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
TABLE author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) TABLE author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) TABLE book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) TABLE books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) TABLE client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) TABLE orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
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") )
Give me the list of ids of all goods whose id has "APP".
medium
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 id FROM goods WHERE id LIKE "%APP%"
{ 'goods': ['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
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'] }
{ 'goods': ['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
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
video_game
CREATE TABLE game ( "Game_ID" INTEGER, "Title" TEXT, "Release_Date" TEXT, "Franchise" TEXT, "Developers" TEXT, "Platform_ID" INTEGER, "Units_sold_Millions" INTEGER, PRIMARY KEY ("Game_ID"), FOREIGN KEY("Platform_ID") REFERENCES platform ("Platform_ID") ) CREATE TABLE game_player ( "Player_ID" INTEGER, "Game_ID" INTEGER, "If_active" BOOLEAN, PRIMARY KEY ("Player_ID", "Game_ID"), FOREIGN KEY("Player_ID") REFERENCES player ("Player_ID"), FOREIGN KEY("Game_ID") REFERENCES game ("Game_ID") ) CREATE TABLE platform ( "Platform_ID" INTEGER, "Platform_name" TEXT, "Market_district" TEXT, "Download_rank" INTEGER, PRIMARY KEY ("Platform_ID") ) CREATE TABLE player ( "Player_ID" INTEGER, "Rank_of_the_year" INTEGER, "Player_name" TEXT, "Position" TEXT, "College" TEXT, PRIMARY KEY ("Player_ID") )
What is the average number of units sold in millions of games played by players with position "Guard"?
hard
Table game ( game.Game_ID (INT), game.Title (TEXT), game.Release_Date (TEXT), game.Franchise (TEXT), game.Developers (TEXT), game.Platform_ID (INT), game.Units_sold_Millions (INT), ) Table game_player ( game_player.Player_ID (INT), game_player.Game_ID (INT), game_player.If_active (bool), ) Table platform ( platform.Platform_ID (INT), platform.Platform_name (TEXT), platform.Market_district (TEXT), platform.Download_rank (INT), ) Table player ( player.Player_ID (INT), player.Rank_of_the_year (INT), player.Player_name (TEXT), player.Position (TEXT), player.College (TEXT), ) Possible JOINs: game.Platform_ID = platform.Platform_ID game_player.Player_ID = player.Player_ID game_player.Game_ID = game.Game_ID
SELECT avg(Units_sold_Millions) FROM game JOIN game_player ON game.Game_ID = game_player.Game_ID JOIN player ON game_player.Player_ID = player.Player_ID WHERE player.Position = "Guard"
{ 'game': ['game_id', 'units_sold_millions'], 'game_player': ['player_id', 'game_id'], 'player': ['player_id', 'position'] }
CREATE TABLE game ( game.Game_ID (INT), game.Title (TEXT), game.Release_Date (TEXT), game.Franchise (TEXT), game.Developers (TEXT), game.Platform_ID (INT), game.Units_sold_Millions (INT), ) CREATE TABLE game_player ( game_player.Player_ID (INT), game_player.Game_ID (INT), game_player.If_active (bool), ) CREATE TABLE platform ( platform.Platform_ID (INT), platform.Platform_name (TEXT), platform.Market_district (TEXT), platform.Download_rank (INT), ) CREATE TABLE player ( player.Player_ID (INT), player.Rank_of_the_year (INT), player.Player_name (TEXT), player.Position (TEXT), player.College (TEXT), ) Possible JOINs: game.Platform_ID = platform.Platform_ID game_player.Player_ID = player.Player_ID game_player.Game_ID = game.Game_ID
Table game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) Table game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) Table platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) Table player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
CREATE TABLE game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) CREATE TABLE game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) CREATE TABLE platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) CREATE TABLE player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
Table game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) Table game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) Table platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) Table player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
CREATE TABLE game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) CREATE TABLE game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) CREATE TABLE platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) CREATE TABLE player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
{ 'platform': ['Platform_ID', 'Platform_name', 'Market_district', 'Download_rank'], 'game': ['Game_ID', 'Title', 'Release_Date', 'Franchise', 'Developers', 'Platform_ID', 'Units_sold_Millions'], 'player': ['Player_ID', 'Rank_of_the_year', 'Player_name', 'Position', 'College'], 'game_player': ['Player_ID', 'Game_ID', 'If_active'] }
{ 'game': ['Game_ID', 'Units_sold_Millions'], 'game_player': ['Player_ID', 'Game_ID'], 'player': ['Player_ID', 'Position'] }
TABLE game ( game.Game_ID (INT), game.Title (TEXT), game.Release_Date (TEXT), game.Franchise (TEXT), game.Developers (TEXT), game.Platform_ID (INT), game.Units_sold_Millions (INT), ) TABLE game_player ( game_player.Player_ID (INT), game_player.Game_ID (INT), game_player.If_active (bool), ) TABLE platform ( platform.Platform_ID (INT), platform.Platform_name (TEXT), platform.Market_district (TEXT), platform.Download_rank (INT), ) TABLE player ( player.Player_ID (INT), player.Rank_of_the_year (INT), player.Player_name (TEXT), player.Position (TEXT), player.College (TEXT), ) Possible JOINs: game.Platform_ID = platform.Platform_ID game_player.Player_ID = player.Player_ID game_player.Game_ID = game.Game_ID
TABLE game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) TABLE game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) TABLE platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) TABLE player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
TABLE game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) TABLE game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) TABLE platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) TABLE player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
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 different contents of boxes, ordered alphabetically?
easy
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 CONTENTS FROM boxes ORDER BY CONTENTS
{ 'boxes': ['code', 'contents'] }
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'] }
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
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") )
Find the name of the movie that is on in both Odeon and Imperial theaters.
extra
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 movies.title FROM movies JOIN movietheaters ON movies.code = movietheaters.movie WHERE movietheaters.name = 'Odeon' INTERSECT SELECT movies.title FROM movies JOIN movietheaters ON movies.code = movietheaters.movie WHERE movietheaters.name = 'Imperial'
{ 'movies': ['code', 'title'], 'movietheaters': ['code', 'name', 'movie'] }
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'], 'MovieTheaters': ['Code', 'Name', 'Movie'] }
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
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) )
Show the number of staff roles.
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 Ref_staff_roles
{ '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
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'] }
{ '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
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
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") )
How many works are there in each medium?
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 count(*) , medium FROM paintings GROUP BY medium
{ 'paintings': ['paintingid', 'medium'] }
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'] }
{ 'Paintings': ['paintingID', '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
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
pilot_1
CREATE TABLE "Hangar" ( plane_name CHAR(15) NOT NULL, location CHAR(15), PRIMARY KEY (plane_name) ) CREATE TABLE "PilotSkills" ( pilot_name CHAR(15) NOT NULL, plane_name CHAR(15) NOT NULL, age INTEGER, PRIMARY KEY (pilot_name, plane_name), FOREIGN KEY(plane_name) REFERENCES "Hangar" (plane_name) )
Count the number of different plane names across all pilots.
easy
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
SELECT count(DISTINCT plane_name) FROM pilotskills
{ 'pilotskills': ['pilot_name', 'plane_name'] }
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) Table PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
CREATE TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) CREATE TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
Table hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) Table pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
CREATE TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) CREATE TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
{ 'PilotSkills': ['pilot_name', 'plane_name', 'age'], 'Hangar': ['plane_name', 'location'] }
{ 'PilotSkills': ['pilot_name', 'plane_name'] }
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE Hangar ( Hangar.plane_name (CHAR(15)), Hangar.location (CHAR(15)), ) TABLE PilotSkills ( PilotSkills.pilot_name (CHAR(15)), PilotSkills.plane_name (CHAR(15)), PilotSkills.age (INTEGER), ) Possible JOINs: PilotSkills.plane_name = Hangar.plane_name
TABLE hangar ( hangar.plane_name (CHAR(15)), hangar.location (CHAR(15)), ) TABLE pilotskills ( pilotskills.pilot_name (CHAR(15)), pilotskills.plane_name (CHAR(15)), pilotskills.age (INTEGER), ) Possible JOINs: pilotskills.plane_name = hangar.plane_name
cre_Doc_and_collections
CREATE TABLE "Collection_Subset_Members" ( "Collection_ID" INTEGER NOT NULL, "Related_Collection_ID" INTEGER NOT NULL, "Collection_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Collection_ID", "Related_Collection_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Related_Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Collection_Subset_ID") REFERENCES "Collection_Subsets" ("Collection_Subset_ID") ) CREATE TABLE "Collection_Subsets" ( "Collection_Subset_ID" INTEGER NOT NULL, "Collection_Subset_Name" VARCHAR(255) NOT NULL, "Collecrtion_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Collection_Subset_ID") ) CREATE TABLE "Collections" ( "Collection_ID" INTEGER NOT NULL, "Parent_Collection_ID" INTEGER, "Collection_Name" VARCHAR(255), "Collection_Description" VARCHAR(255), PRIMARY KEY ("Collection_ID") ) CREATE TABLE "Document_Objects" ( "Document_Object_ID" INTEGER NOT NULL, "Parent_Document_Object_ID" INTEGER, "Owner" VARCHAR(255), "Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_Object_ID") ) CREATE TABLE "Document_Subset_Members" ( "Document_Object_ID" INTEGER NOT NULL, "Related_Document_Object_ID" INTEGER NOT NULL, "Document_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Related_Document_Object_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Document_Subset_ID") REFERENCES "Document_Subsets" ("Document_Subset_ID"), FOREIGN KEY("Related_Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID") ) CREATE TABLE "Document_Subsets" ( "Document_Subset_ID" INTEGER NOT NULL, "Document_Subset_Name" VARCHAR(255) NOT NULL, "Document_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Subset_ID") ) CREATE TABLE "Documents_in_Collections" ( "Document_Object_ID" INTEGER NOT NULL, "Collection_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Collection_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID") )
For the document subset named 'Best for 2000', what are the document ids in that subset?
medium
Table Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) Table Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) Table Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
SELECT DISTINCT Document_Subset_Members.Document_Object_ID FROM Document_Subset_Members JOIN Document_Subsets ON Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID WHERE Document_Subsets.Document_Subset_Name = "Best for 2000";
{ 'document_subset_members': ['document_object_id', 'document_subset_id'], 'document_subsets': ['document_subset_id', 'document_subset_name'] }
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
Table Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) Table Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) Table Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
Table collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) Table collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) Table collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) Table document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) Table document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) Table document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) Table documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
CREATE TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) CREATE TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) CREATE TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) CREATE TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) CREATE TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
{ 'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name', 'Document_Subset_Details'], 'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name', 'Collecrtion_Subset_Details'], 'Document_Objects': ['Document_Object_ID', 'Parent_Document_Object_ID', 'Owner', 'Description', 'Other_Details'], 'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name', 'Collection_Description'], 'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'], 'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'], 'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID', 'Collection_Subset_ID'] }
{ 'Document_Subset_Members': ['Document_Object_ID', 'Document_Subset_ID'], 'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name'] }
TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
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) )
What is the name and age of every sailor who is younger than age 30?
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 name , age FROM Sailors WHERE age < 30
{ 'sailors': ['sid', 'name', 'age'] }
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', 'age'] }
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
e_commerce
CREATE TABLE "Customer_Payment_Methods" ( customer_id INTEGER NOT NULL, payment_method_code VARCHAR(10) NOT NULL, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, gender_code VARCHAR(1) NOT NULL, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), address_line_1 VARCHAR(255), town_city VARCHAR(50), county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, invoice_status_code VARCHAR(10) NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, product_id INTEGER NOT NULL, order_id INTEGER NOT NULL, order_item_status_code VARCHAR(10) NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, date_order_placed DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, product_name VARCHAR(80), product_price DECIMAL(19, 4) DEFAULT 0, product_color VARCHAR(50), product_size VARCHAR(50), product_description VARCHAR(255), PRIMARY KEY (product_id) ) CREATE TABLE "Shipment_Items" ( shipment_id INTEGER NOT NULL, order_item_id INTEGER NOT NULL, PRIMARY KEY (shipment_id, order_item_id), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id), FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id) ) CREATE TABLE "Shipments" ( shipment_id INTEGER, order_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, PRIMARY KEY (shipment_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) )
What are the login names and passwords of the customers whose phone number have the prefix '+12'?
medium
Table Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) Table Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) Table Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) Table Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) Table Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) Table Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
SELECT login_name , login_password FROM Customers WHERE phone_number LIKE '+12%'
{ 'customers': ['customer_id', 'login_name', 'login_password', 'phone_number'] }
CREATE TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) CREATE TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) CREATE TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) CREATE TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
Table Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) Table Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) Table Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) Table Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) Table Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) Table Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
CREATE TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) CREATE TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) CREATE TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) CREATE TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
Table customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) Table customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) Table invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) Table orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) Table products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) Table shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) Table shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
CREATE TABLE customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) CREATE TABLE invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) CREATE TABLE orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) CREATE TABLE products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) CREATE TABLE shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) CREATE TABLE shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
{ 'Products': ['product_id', 'parent_product_id', 'product_name', 'product_price', 'product_color', 'product_size', 'product_description'], 'Customers': ['customer_id', 'gender_code', 'customer_first_name', 'customer_middle_initial', 'customer_last_name', 'email_address', 'login_name', 'login_password', 'phone_number', 'address_line_1', 'town_city', 'county', 'country'], 'Customer_Payment_Methods': ['customer_id', 'payment_method_code'], 'Invoices': ['invoice_number', 'invoice_status_code', 'invoice_date'], 'Orders': ['order_id', 'customer_id', 'order_status_code', 'date_order_placed'], 'Order_Items': ['order_item_id', 'product_id', 'order_id', 'order_item_status_code'], 'Shipments': ['shipment_id', 'order_id', 'invoice_number', 'shipment_tracking_number', 'shipment_date'], 'Shipment_Items': ['shipment_id', 'order_item_id'] }
{ 'Customers': ['customer_id', 'login_name', 'login_password', 'phone_number'] }
TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
TABLE Customer_Payment_Methods ( Customer_Payment_Methods.customer_id (INTEGER), Customer_Payment_Methods.payment_method_code (VARCHAR(10)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.gender_code (VARCHAR(1)), Customers.customer_first_name (VARCHAR(50)), Customers.customer_middle_initial (VARCHAR(1)), Customers.customer_last_name (VARCHAR(50)), Customers.email_address (VARCHAR(255)), Customers.login_name (VARCHAR(80)), Customers.login_password (VARCHAR(20)), Customers.phone_number (VARCHAR(255)), Customers.address_line_1 (VARCHAR(255)), Customers.town_city (VARCHAR(50)), Customers.county (VARCHAR(50)), Customers.country (VARCHAR(50)), ) TABLE Invoices ( Invoices.invoice_number (INTEGER), Invoices.invoice_status_code (VARCHAR(10)), Invoices.invoice_date (DATETIME), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.order_item_status_code (VARCHAR(10)), ) TABLE Orders ( Orders.order_id (INTEGER), Orders.customer_id (INTEGER), Orders.order_status_code (VARCHAR(10)), Orders.date_order_placed (DATETIME), ) TABLE Products ( Products.product_id (INTEGER), Products.parent_product_id (INTEGER), Products.product_name (VARCHAR(80)), Products.product_price (DECIMAL(19,4)), Products.product_color (VARCHAR(50)), Products.product_size (VARCHAR(50)), Products.product_description (VARCHAR(255)), ) TABLE Shipment_Items ( Shipment_Items.shipment_id (INTEGER), Shipment_Items.order_item_id (INTEGER), ) TABLE Shipments ( Shipments.shipment_id (INTEGER), Shipments.order_id (INTEGER), Shipments.invoice_number (INTEGER), Shipments.shipment_tracking_number (VARCHAR(80)), Shipments.shipment_date (DATETIME), ) Possible JOINs: Customer_Payment_Methods.customer_id = Customers.customer_id Order_Items.product_id = Products.product_id Order_Items.order_id = Orders.order_id Orders.customer_id = Customers.customer_id Shipment_Items.shipment_id = Shipments.shipment_id Shipment_Items.order_item_id = Order_Items.order_item_id Shipments.order_id = Orders.order_id Shipments.invoice_number = Invoices.invoice_number
TABLE customer_payment_methods ( customer_payment_methods.customer_id (INTEGER), customer_payment_methods.payment_method_code (VARCHAR(10)), ) TABLE customers ( customers.customer_id (INTEGER), customers.gender_code (VARCHAR(1)), customers.customer_first_name (VARCHAR(50)), customers.customer_middle_initial (VARCHAR(1)), customers.customer_last_name (VARCHAR(50)), customers.email_address (VARCHAR(255)), customers.login_name (VARCHAR(80)), customers.login_password (VARCHAR(20)), customers.phone_number (VARCHAR(255)), customers.address_line_1 (VARCHAR(255)), customers.town_city (VARCHAR(50)), customers.county (VARCHAR(50)), customers.country (VARCHAR(50)), ) TABLE invoices ( invoices.invoice_number (INTEGER), invoices.invoice_status_code (VARCHAR(10)), invoices.invoice_date (DATETIME), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.product_id (INTEGER), order_items.order_id (INTEGER), order_items.order_item_status_code (VARCHAR(10)), ) TABLE orders ( orders.order_id (INTEGER), orders.customer_id (INTEGER), orders.order_status_code (VARCHAR(10)), orders.date_order_placed (DATETIME), ) TABLE products ( products.product_id (INTEGER), products.parent_product_id (INTEGER), products.product_name (VARCHAR(80)), products.product_price (DECIMAL(19,4)), products.product_color (VARCHAR(50)), products.product_size (VARCHAR(50)), products.product_description (VARCHAR(255)), ) TABLE shipment_items ( shipment_items.shipment_id (INTEGER), shipment_items.order_item_id (INTEGER), ) TABLE shipments ( shipments.shipment_id (INTEGER), shipments.order_id (INTEGER), shipments.invoice_number (INTEGER), shipments.shipment_tracking_number (VARCHAR(80)), shipments.shipment_date (DATETIME), ) Possible JOINs: customer_payment_methods.customer_id = customers.customer_id order_items.product_id = products.product_id order_items.order_id = orders.order_id orders.customer_id = customers.customer_id shipment_items.shipment_id = shipments.shipment_id shipment_items.order_item_id = order_items.order_item_id shipments.order_id = orders.order_id shipments.invoice_number = invoices.invoice_number
government_shift
CREATE TABLE "Analytical_Layer" ( "Analytical_ID" INTEGER NOT NULL, "Customers_and_Services_ID" VARCHAR(40) NOT NULL, "Pattern_Recognition" VARCHAR(255) NOT NULL, "Analytical_Layer_Type_Code" CHAR(15), PRIMARY KEY ("Analytical_ID"), FOREIGN KEY("Customers_and_Services_ID") REFERENCES "Customers_and_Services" ("Customers_and_Services_ID") ) CREATE TABLE "Channels" ( "Channel_ID" INTEGER NOT NULL, "Channel_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Channel_ID") ) CREATE TABLE "Customer_Interactions" ( "Customer_Interaction_ID" INTEGER NOT NULL, "Channel_ID" INTEGER, "Customer_ID" INTEGER, "Service_ID" INTEGER, "Status_Code" CHAR(15), "Services_and_Channels_Details" VARCHAR(255), PRIMARY KEY ("Customer_Interaction_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Channel_ID") REFERENCES "Channels" ("Channel_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Customers" ( "Customer_ID" INTEGER NOT NULL, "Customer_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Customer_ID") ) CREATE TABLE "Customers_and_Services" ( "Customers_and_Services_ID" INTEGER NOT NULL, "Customer_ID" INTEGER, "Service_ID" INTEGER, "Customers_and_Services_Details" CHAR(15) NOT NULL, PRIMARY KEY ("Customers_and_Services_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Integration_Platform" ( "Integration_Platform_ID" INTEGER NOT NULL, "Customer_Interaction_ID" INTEGER NOT NULL, "Integration_Platform_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Integration_Platform_ID"), FOREIGN KEY("Customer_Interaction_ID") REFERENCES "Customer_Interactions" ("Customer_Interaction_ID") ) CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_Details" VARCHAR(255), PRIMARY KEY ("Service_ID") )
return the details of the customer with largest count of used services.
extra
Table Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) Table Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) Table Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) Table Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) Table Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) Table Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) Table Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
SELECT customers.customer_details FROM customers JOIN customers_and_services ON customers.customer_id = customers_and_services.customer_id GROUP BY customers.customer_details ORDER BY count(*) DESC LIMIT 1
{ 'customers': ['customer_id', 'customer_details'], 'customers_and_services': ['customers_and_services_id', 'customer_id'] }
CREATE TABLE Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) CREATE TABLE Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) CREATE TABLE Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) CREATE TABLE Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) CREATE TABLE Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) CREATE TABLE Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) CREATE TABLE Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
Table Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) Table Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) Table Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) Table Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) Table Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) Table Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
CREATE TABLE Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) CREATE TABLE Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) CREATE TABLE Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) CREATE TABLE Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) CREATE TABLE Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) CREATE TABLE Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
Table analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) Table channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) Table customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) Table customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) Table customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) Table integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) Table services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
CREATE TABLE analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) CREATE TABLE channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) CREATE TABLE customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) CREATE TABLE customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) CREATE TABLE integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) CREATE TABLE services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
{ 'Services': ['Service_ID', 'Service_Details'], 'Customers': ['Customer_ID', 'Customer_Details'], 'Channels': ['Channel_ID', 'Channel_Details'], 'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID', 'Customers_and_Services_Details'], 'Customer_Interactions': ['Customer_Interaction_ID', 'Channel_ID', 'Customer_ID', 'Service_ID', 'Status_Code', 'Services_and_Channels_Details'], 'Integration_Platform': ['Integration_Platform_ID', 'Customer_Interaction_ID', 'Integration_Platform_Details'], 'Analytical_Layer': ['Analytical_ID', 'Customers_and_Services_ID', 'Pattern_Recognition', 'Analytical_Layer_Type_Code'] }
{ 'Customers': ['Customer_ID', 'Customer_Details'], 'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID'] }
TABLE Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) TABLE Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) TABLE Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) TABLE Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) TABLE Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) TABLE Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) TABLE Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
TABLE Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) TABLE Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) TABLE Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) TABLE Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) TABLE Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) TABLE Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
TABLE analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) TABLE channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) TABLE customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) TABLE customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) TABLE customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) TABLE integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) TABLE services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
video_game
CREATE TABLE game ( "Game_ID" INTEGER, "Title" TEXT, "Release_Date" TEXT, "Franchise" TEXT, "Developers" TEXT, "Platform_ID" INTEGER, "Units_sold_Millions" INTEGER, PRIMARY KEY ("Game_ID"), FOREIGN KEY("Platform_ID") REFERENCES platform ("Platform_ID") ) CREATE TABLE game_player ( "Player_ID" INTEGER, "Game_ID" INTEGER, "If_active" BOOLEAN, PRIMARY KEY ("Player_ID", "Game_ID"), FOREIGN KEY("Player_ID") REFERENCES player ("Player_ID"), FOREIGN KEY("Game_ID") REFERENCES game ("Game_ID") ) CREATE TABLE platform ( "Platform_ID" INTEGER, "Platform_name" TEXT, "Market_district" TEXT, "Download_rank" INTEGER, PRIMARY KEY ("Platform_ID") ) CREATE TABLE player ( "Player_ID" INTEGER, "Rank_of_the_year" INTEGER, "Player_name" TEXT, "Position" TEXT, "College" TEXT, PRIMARY KEY ("Player_ID") )
Show the title of games that are played by both players from college "Oklahoma" and players from college "Auburn".
extra
Table game ( game.Game_ID (INT), game.Title (TEXT), game.Release_Date (TEXT), game.Franchise (TEXT), game.Developers (TEXT), game.Platform_ID (INT), game.Units_sold_Millions (INT), ) Table game_player ( game_player.Player_ID (INT), game_player.Game_ID (INT), game_player.If_active (bool), ) Table platform ( platform.Platform_ID (INT), platform.Platform_name (TEXT), platform.Market_district (TEXT), platform.Download_rank (INT), ) Table player ( player.Player_ID (INT), player.Rank_of_the_year (INT), player.Player_name (TEXT), player.Position (TEXT), player.College (TEXT), ) Possible JOINs: game.Platform_ID = platform.Platform_ID game_player.Player_ID = player.Player_ID game_player.Game_ID = game.Game_ID
SELECT game.Title FROM game JOIN game_player ON game.Game_ID = game_player.Game_ID JOIN player ON game_player.Player_ID = player.Player_ID WHERE player.College = "Oklahoma" INTERSECT SELECT game.Title FROM game JOIN game_player ON game.Game_ID = game_player.Game_ID JOIN player ON game_player.Player_ID = player.Player_ID WHERE player.College = "Auburn"
{ 'game': ['game_id', 'title'], 'game_player': ['player_id', 'game_id'], 'player': ['player_id', 'college'] }
CREATE TABLE game ( game.Game_ID (INT), game.Title (TEXT), game.Release_Date (TEXT), game.Franchise (TEXT), game.Developers (TEXT), game.Platform_ID (INT), game.Units_sold_Millions (INT), ) CREATE TABLE game_player ( game_player.Player_ID (INT), game_player.Game_ID (INT), game_player.If_active (bool), ) CREATE TABLE platform ( platform.Platform_ID (INT), platform.Platform_name (TEXT), platform.Market_district (TEXT), platform.Download_rank (INT), ) CREATE TABLE player ( player.Player_ID (INT), player.Rank_of_the_year (INT), player.Player_name (TEXT), player.Position (TEXT), player.College (TEXT), ) Possible JOINs: game.Platform_ID = platform.Platform_ID game_player.Player_ID = player.Player_ID game_player.Game_ID = game.Game_ID
Table game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) Table game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) Table platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) Table player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
CREATE TABLE game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) CREATE TABLE game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) CREATE TABLE platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) CREATE TABLE player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
Table game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) Table game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) Table platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) Table player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
CREATE TABLE game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) CREATE TABLE game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) CREATE TABLE platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) CREATE TABLE player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
{ 'platform': ['Platform_ID', 'Platform_name', 'Market_district', 'Download_rank'], 'game': ['Game_ID', 'Title', 'Release_Date', 'Franchise', 'Developers', 'Platform_ID', 'Units_sold_Millions'], 'player': ['Player_ID', 'Rank_of_the_year', 'Player_name', 'Position', 'College'], 'game_player': ['Player_ID', 'Game_ID', 'If_active'] }
{ 'game': ['Game_ID', 'Title'], 'game_player': ['Player_ID', 'Game_ID'], 'player': ['Player_ID', 'College'] }
TABLE game ( game.Game_ID (INT), game.Title (TEXT), game.Release_Date (TEXT), game.Franchise (TEXT), game.Developers (TEXT), game.Platform_ID (INT), game.Units_sold_Millions (INT), ) TABLE game_player ( game_player.Player_ID (INT), game_player.Game_ID (INT), game_player.If_active (bool), ) TABLE platform ( platform.Platform_ID (INT), platform.Platform_name (TEXT), platform.Market_district (TEXT), platform.Download_rank (INT), ) TABLE player ( player.Player_ID (INT), player.Rank_of_the_year (INT), player.Player_name (TEXT), player.Position (TEXT), player.College (TEXT), ) Possible JOINs: game.Platform_ID = platform.Platform_ID game_player.Player_ID = player.Player_ID game_player.Game_ID = game.Game_ID
TABLE game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) TABLE game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) TABLE platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) TABLE player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
TABLE game ( game.game_id (INT), game.title (TEXT), game.release_date (TEXT), game.franchise (TEXT), game.developers (TEXT), game.platform_id (INT), game.units_sold_millions (INT), ) TABLE game_player ( game_player.player_id (INT), game_player.game_id (INT), game_player.if_active (bool), ) TABLE platform ( platform.platform_id (INT), platform.platform_name (TEXT), platform.market_district (TEXT), platform.download_rank (INT), ) TABLE player ( player.player_id (INT), player.rank_of_the_year (INT), player.player_name (TEXT), player.position (TEXT), player.college (TEXT), ) Possible JOINs: game.platform_id = platform.platform_id game_player.player_id = player.player_id game_player.game_id = game.game_id
planet_1
CREATE TABLE "Client" ( "AccountNumber" INTEGER, "Name" VARCHAR(255) NOT NULL, PRIMARY KEY ("AccountNumber") ) CREATE TABLE "Employee" ( "EmployeeID" INTEGER, "Name" VARCHAR(255) NOT NULL, "Position" VARCHAR(255) NOT NULL, "Salary" REAL NOT NULL, "Remarks" VARCHAR(255), PRIMARY KEY ("EmployeeID") ) CREATE TABLE "Has_Clearance" ( "Employee" INTEGER NOT NULL, "Planet" INTEGER NOT NULL, "Level" INTEGER NOT NULL, PRIMARY KEY ("Employee", "Planet"), FOREIGN KEY("Employee") REFERENCES "Employee" ("EmployeeID"), FOREIGN KEY("Planet") REFERENCES "Planet" ("PlanetID") ) CREATE TABLE "Package" ( "Shipment" INTEGER NOT NULL, "PackageNumber" INTEGER NOT NULL, "Contents" VARCHAR(255) NOT NULL, "Weight" REAL NOT NULL, "Sender" INTEGER NOT NULL, "Recipient" INTEGER NOT NULL, PRIMARY KEY ("Shipment", "PackageNumber"), FOREIGN KEY("Shipment") REFERENCES "Shipment" ("ShipmentID"), FOREIGN KEY("Sender") REFERENCES "Client" ("AccountNumber"), FOREIGN KEY("Recipient") REFERENCES "Client" ("AccountNumber") ) CREATE TABLE "Planet" ( "PlanetID" INTEGER, "Name" VARCHAR(255) NOT NULL, "Coordinates" REAL NOT NULL, PRIMARY KEY ("PlanetID") ) CREATE TABLE "Shipment" ( "ShipmentID" INTEGER, "Date" DATE, "Manager" INTEGER NOT NULL, "Planet" INTEGER NOT NULL, PRIMARY KEY ("ShipmentID"), FOREIGN KEY("Manager") REFERENCES "Employee" ("EmployeeID"), FOREIGN KEY("Planet") REFERENCES "Planet" ("PlanetID") )
What is the name of all clients who sent more than one package?
medium
Table Client ( Client.AccountNumber (INTEGER), Client.Name (VARCHAR(255)), ) Table Employee ( Employee.EmployeeID (INTEGER), Employee.Name (VARCHAR(255)), Employee.Position (VARCHAR(255)), Employee.Salary (REAL), Employee.Remarks (VARCHAR(255)), ) Table Has_Clearance ( Has_Clearance.Employee (INTEGER), Has_Clearance.Planet (INTEGER), Has_Clearance.Level (INTEGER), ) Table Package ( Package.Shipment (INTEGER), Package.PackageNumber (INTEGER), Package.Contents (VARCHAR(255)), Package.Weight (REAL), Package.Sender (INTEGER), Package.Recipient (INTEGER), ) Table Planet ( Planet.PlanetID (INTEGER), Planet.Name (VARCHAR(255)), Planet.Coordinates (REAL), ) Table Shipment ( Shipment.ShipmentID (INTEGER), Shipment.Date (DATE), Shipment.Manager (INTEGER), Shipment.Planet (INTEGER), ) Possible JOINs: Has_Clearance.Employee = Employee.EmployeeID Has_Clearance.Planet = Planet.PlanetID Package.Shipment = Shipment.ShipmentID Package.Sender = Client.AccountNumber Package.Recipient = Client.AccountNumber Shipment.Manager = Employee.EmployeeID Shipment.Planet = Planet.PlanetID
SELECT Client.Name , count(*) FROM PACKAGE AS T1 JOIN Client ON T1.Sender = Client.AccountNumber GROUP BY T1.Sender HAVING count(*) > 1;
{ 'package': ['shipment'], 'client': ['accountnumber', 'name'] }
CREATE TABLE Client ( Client.AccountNumber (INTEGER), Client.Name (VARCHAR(255)), ) CREATE TABLE Employee ( Employee.EmployeeID (INTEGER), Employee.Name (VARCHAR(255)), Employee.Position (VARCHAR(255)), Employee.Salary (REAL), Employee.Remarks (VARCHAR(255)), ) CREATE TABLE Has_Clearance ( Has_Clearance.Employee (INTEGER), Has_Clearance.Planet (INTEGER), Has_Clearance.Level (INTEGER), ) CREATE TABLE Package ( Package.Shipment (INTEGER), Package.PackageNumber (INTEGER), Package.Contents (VARCHAR(255)), Package.Weight (REAL), Package.Sender (INTEGER), Package.Recipient (INTEGER), ) CREATE TABLE Planet ( Planet.PlanetID (INTEGER), Planet.Name (VARCHAR(255)), Planet.Coordinates (REAL), ) CREATE TABLE Shipment ( Shipment.ShipmentID (INTEGER), Shipment.Date (DATE), Shipment.Manager (INTEGER), Shipment.Planet (INTEGER), ) Possible JOINs: Has_Clearance.Employee = Employee.EmployeeID Has_Clearance.Planet = Planet.PlanetID Package.Shipment = Shipment.ShipmentID Package.Sender = Client.AccountNumber Package.Recipient = Client.AccountNumber Shipment.Manager = Employee.EmployeeID Shipment.Planet = Planet.PlanetID
Table Client ( Client.accountnumber (INTEGER), Client.name (VARCHAR(255)), ) Table Employee ( Employee.employeeid (INTEGER), Employee.name (VARCHAR(255)), Employee.position (VARCHAR(255)), Employee.salary (REAL), Employee.remarks (VARCHAR(255)), ) Table Has_Clearance ( Has_Clearance.employee (INTEGER), Has_Clearance.planet (INTEGER), Has_Clearance.level (INTEGER), ) Table Package ( Package.shipment (INTEGER), Package.packagenumber (INTEGER), Package.contents (VARCHAR(255)), Package.weight (REAL), Package.sender (INTEGER), Package.recipient (INTEGER), ) Table Planet ( Planet.planetid (INTEGER), Planet.name (VARCHAR(255)), Planet.coordinates (REAL), ) Table Shipment ( Shipment.shipmentid (INTEGER), Shipment.date (DATE), Shipment.manager (INTEGER), Shipment.planet (INTEGER), ) Possible JOINs: Has_Clearance.employee = Employee.employeeid Has_Clearance.planet = Planet.planetid Package.shipment = Shipment.shipmentid Package.sender = Client.accountnumber Package.recipient = Client.accountnumber Shipment.manager = Employee.employeeid Shipment.planet = Planet.planetid
CREATE TABLE Client ( Client.accountnumber (INTEGER), Client.name (VARCHAR(255)), ) CREATE TABLE Employee ( Employee.employeeid (INTEGER), Employee.name (VARCHAR(255)), Employee.position (VARCHAR(255)), Employee.salary (REAL), Employee.remarks (VARCHAR(255)), ) CREATE TABLE Has_Clearance ( Has_Clearance.employee (INTEGER), Has_Clearance.planet (INTEGER), Has_Clearance.level (INTEGER), ) CREATE TABLE Package ( Package.shipment (INTEGER), Package.packagenumber (INTEGER), Package.contents (VARCHAR(255)), Package.weight (REAL), Package.sender (INTEGER), Package.recipient (INTEGER), ) CREATE TABLE Planet ( Planet.planetid (INTEGER), Planet.name (VARCHAR(255)), Planet.coordinates (REAL), ) CREATE TABLE Shipment ( Shipment.shipmentid (INTEGER), Shipment.date (DATE), Shipment.manager (INTEGER), Shipment.planet (INTEGER), ) Possible JOINs: Has_Clearance.employee = Employee.employeeid Has_Clearance.planet = Planet.planetid Package.shipment = Shipment.shipmentid Package.sender = Client.accountnumber Package.recipient = Client.accountnumber Shipment.manager = Employee.employeeid Shipment.planet = Planet.planetid
Table client ( client.accountnumber (INTEGER), client.name (VARCHAR(255)), ) Table employee ( employee.employeeid (INTEGER), employee.name (VARCHAR(255)), employee.position (VARCHAR(255)), employee.salary (REAL), employee.remarks (VARCHAR(255)), ) Table has_clearance ( has_clearance.employee (INTEGER), has_clearance.planet (INTEGER), has_clearance.level (INTEGER), ) Table package ( package.shipment (INTEGER), package.packagenumber (INTEGER), package.contents (VARCHAR(255)), package.weight (REAL), package.sender (INTEGER), package.recipient (INTEGER), ) Table planet ( planet.planetid (INTEGER), planet.name (VARCHAR(255)), planet.coordinates (REAL), ) Table shipment ( shipment.shipmentid (INTEGER), shipment.date (DATE), shipment.manager (INTEGER), shipment.planet (INTEGER), ) Possible JOINs: has_clearance.employee = employee.employeeid has_clearance.planet = planet.planetid package.shipment = shipment.shipmentid package.sender = client.accountnumber package.recipient = client.accountnumber shipment.manager = employee.employeeid shipment.planet = planet.planetid
CREATE TABLE client ( client.accountnumber (INTEGER), client.name (VARCHAR(255)), ) CREATE TABLE employee ( employee.employeeid (INTEGER), employee.name (VARCHAR(255)), employee.position (VARCHAR(255)), employee.salary (REAL), employee.remarks (VARCHAR(255)), ) CREATE TABLE has_clearance ( has_clearance.employee (INTEGER), has_clearance.planet (INTEGER), has_clearance.level (INTEGER), ) CREATE TABLE package ( package.shipment (INTEGER), package.packagenumber (INTEGER), package.contents (VARCHAR(255)), package.weight (REAL), package.sender (INTEGER), package.recipient (INTEGER), ) CREATE TABLE planet ( planet.planetid (INTEGER), planet.name (VARCHAR(255)), planet.coordinates (REAL), ) CREATE TABLE shipment ( shipment.shipmentid (INTEGER), shipment.date (DATE), shipment.manager (INTEGER), shipment.planet (INTEGER), ) Possible JOINs: has_clearance.employee = employee.employeeid has_clearance.planet = planet.planetid package.shipment = shipment.shipmentid package.sender = client.accountnumber package.recipient = client.accountnumber shipment.manager = employee.employeeid shipment.planet = planet.planetid
{ 'Employee': ['EmployeeID', 'Name', 'Position', 'Salary', 'Remarks'], 'Planet': ['PlanetID', 'Name', 'Coordinates'], 'Shipment': ['ShipmentID', 'Date', 'Manager', 'Planet'], 'Has_Clearance': ['Employee', 'Planet', 'Level'], 'Client': ['AccountNumber', 'Name'], 'Package': ['Shipment', 'PackageNumber', 'Contents', 'Weight', 'Sender', 'Recipient'] }
{ 'Package': ['Shipment'], 'Client': ['AccountNumber', 'Name'] }
TABLE Client ( Client.AccountNumber (INTEGER), Client.Name (VARCHAR(255)), ) TABLE Employee ( Employee.EmployeeID (INTEGER), Employee.Name (VARCHAR(255)), Employee.Position (VARCHAR(255)), Employee.Salary (REAL), Employee.Remarks (VARCHAR(255)), ) TABLE Has_Clearance ( Has_Clearance.Employee (INTEGER), Has_Clearance.Planet (INTEGER), Has_Clearance.Level (INTEGER), ) TABLE Package ( Package.Shipment (INTEGER), Package.PackageNumber (INTEGER), Package.Contents (VARCHAR(255)), Package.Weight (REAL), Package.Sender (INTEGER), Package.Recipient (INTEGER), ) TABLE Planet ( Planet.PlanetID (INTEGER), Planet.Name (VARCHAR(255)), Planet.Coordinates (REAL), ) TABLE Shipment ( Shipment.ShipmentID (INTEGER), Shipment.Date (DATE), Shipment.Manager (INTEGER), Shipment.Planet (INTEGER), ) Possible JOINs: Has_Clearance.Employee = Employee.EmployeeID Has_Clearance.Planet = Planet.PlanetID Package.Shipment = Shipment.ShipmentID Package.Sender = Client.AccountNumber Package.Recipient = Client.AccountNumber Shipment.Manager = Employee.EmployeeID Shipment.Planet = Planet.PlanetID
TABLE Client ( Client.accountnumber (INTEGER), Client.name (VARCHAR(255)), ) TABLE Employee ( Employee.employeeid (INTEGER), Employee.name (VARCHAR(255)), Employee.position (VARCHAR(255)), Employee.salary (REAL), Employee.remarks (VARCHAR(255)), ) TABLE Has_Clearance ( Has_Clearance.employee (INTEGER), Has_Clearance.planet (INTEGER), Has_Clearance.level (INTEGER), ) TABLE Package ( Package.shipment (INTEGER), Package.packagenumber (INTEGER), Package.contents (VARCHAR(255)), Package.weight (REAL), Package.sender (INTEGER), Package.recipient (INTEGER), ) TABLE Planet ( Planet.planetid (INTEGER), Planet.name (VARCHAR(255)), Planet.coordinates (REAL), ) TABLE Shipment ( Shipment.shipmentid (INTEGER), Shipment.date (DATE), Shipment.manager (INTEGER), Shipment.planet (INTEGER), ) Possible JOINs: Has_Clearance.employee = Employee.employeeid Has_Clearance.planet = Planet.planetid Package.shipment = Shipment.shipmentid Package.sender = Client.accountnumber Package.recipient = Client.accountnumber Shipment.manager = Employee.employeeid Shipment.planet = Planet.planetid
TABLE client ( client.accountnumber (INTEGER), client.name (VARCHAR(255)), ) TABLE employee ( employee.employeeid (INTEGER), employee.name (VARCHAR(255)), employee.position (VARCHAR(255)), employee.salary (REAL), employee.remarks (VARCHAR(255)), ) TABLE has_clearance ( has_clearance.employee (INTEGER), has_clearance.planet (INTEGER), has_clearance.level (INTEGER), ) TABLE package ( package.shipment (INTEGER), package.packagenumber (INTEGER), package.contents (VARCHAR(255)), package.weight (REAL), package.sender (INTEGER), package.recipient (INTEGER), ) TABLE planet ( planet.planetid (INTEGER), planet.name (VARCHAR(255)), planet.coordinates (REAL), ) TABLE shipment ( shipment.shipmentid (INTEGER), shipment.date (DATE), shipment.manager (INTEGER), shipment.planet (INTEGER), ) Possible JOINs: has_clearance.employee = employee.employeeid has_clearance.planet = planet.planetid package.shipment = shipment.shipmentid package.sender = client.accountnumber package.recipient = client.accountnumber shipment.manager = employee.employeeid shipment.planet = planet.planetid
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") )
What is the most common type of affiliation for institutions?
hard
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 Affiliation FROM institution GROUP BY Affiliation ORDER BY COUNT(*) DESC LIMIT 1
{ 'institution': ['institution_id', 'affiliation'] }
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', 'Affiliation'] }
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
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") )
What is the nickname of the institution with the smallest enrollment?
hard
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 championship.Nickname FROM championship JOIN institution ON championship.Institution_ID = institution.Institution_ID ORDER BY institution.Enrollment ASC LIMIT 1
{ 'championship': ['institution_id', 'nickname'], 'institution': ['institution_id', 'enrollment'] }
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'] }
{ 'Championship': ['Institution_ID', 'Nickname'], 'institution': ['Institution_ID', 'Enrollment'] }
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
advertising_agencies
CREATE TABLE "Agencies" ( agency_id INTEGER, agency_details VARCHAR(255) NOT NULL, PRIMARY KEY (agency_id) ) CREATE TABLE "Clients" ( client_id INTEGER, agency_id INTEGER NOT NULL, sic_code VARCHAR(10) NOT NULL, client_details VARCHAR(255) NOT NULL, PRIMARY KEY (client_id), FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id) ) CREATE TABLE "Invoices" ( invoice_id INTEGER, client_id INTEGER NOT NULL, invoice_status VARCHAR(10) NOT NULL, invoice_details VARCHAR(255) NOT NULL, PRIMARY KEY (invoice_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Meetings" ( meeting_id INTEGER, client_id INTEGER NOT NULL, meeting_outcome VARCHAR(10) NOT NULL, meeting_type VARCHAR(10) NOT NULL, billable_yn VARCHAR(1), start_date_time DATETIME, end_date_time DATETIME, purpose_of_meeting VARCHAR(255), other_details VARCHAR(255) NOT NULL, PRIMARY KEY (meeting_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Payments" ( payment_id INTEGER NOT NULL, invoice_id INTEGER NOT NULL, payment_details VARCHAR(255) NOT NULL, FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, agency_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_in_Meetings" ( meeting_id INTEGER NOT NULL, staff_id INTEGER NOT NULL, FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id) )
Show all sic codes and the number of clients with each code.
medium
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
SELECT sic_code , count(*) FROM Clients GROUP BY sic_code
{ 'clients': ['client_id', 'sic_code'] }
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) Table clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) Table invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) Table meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) Table payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) Table staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) Table staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
CREATE TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) CREATE TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) CREATE TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) CREATE TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) CREATE TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) CREATE TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
{ 'Agencies': ['agency_id', 'agency_details'], 'Staff': ['staff_id', 'agency_id', 'staff_details'], 'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'], 'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'], 'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'], 'Payments': ['payment_id', 'invoice_id', 'payment_details'], 'Staff_in_Meetings': ['meeting_id', 'staff_id'] }
{ 'Clients': ['client_id', 'sic_code'] }
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
cre_Doc_and_collections
CREATE TABLE "Collection_Subset_Members" ( "Collection_ID" INTEGER NOT NULL, "Related_Collection_ID" INTEGER NOT NULL, "Collection_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Collection_ID", "Related_Collection_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Related_Collection_ID") REFERENCES "Collections" ("Collection_ID"), FOREIGN KEY("Collection_Subset_ID") REFERENCES "Collection_Subsets" ("Collection_Subset_ID") ) CREATE TABLE "Collection_Subsets" ( "Collection_Subset_ID" INTEGER NOT NULL, "Collection_Subset_Name" VARCHAR(255) NOT NULL, "Collecrtion_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Collection_Subset_ID") ) CREATE TABLE "Collections" ( "Collection_ID" INTEGER NOT NULL, "Parent_Collection_ID" INTEGER, "Collection_Name" VARCHAR(255), "Collection_Description" VARCHAR(255), PRIMARY KEY ("Collection_ID") ) CREATE TABLE "Document_Objects" ( "Document_Object_ID" INTEGER NOT NULL, "Parent_Document_Object_ID" INTEGER, "Owner" VARCHAR(255), "Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_Object_ID") ) CREATE TABLE "Document_Subset_Members" ( "Document_Object_ID" INTEGER NOT NULL, "Related_Document_Object_ID" INTEGER NOT NULL, "Document_Subset_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Related_Document_Object_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Document_Subset_ID") REFERENCES "Document_Subsets" ("Document_Subset_ID"), FOREIGN KEY("Related_Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID") ) CREATE TABLE "Document_Subsets" ( "Document_Subset_ID" INTEGER NOT NULL, "Document_Subset_Name" VARCHAR(255) NOT NULL, "Document_Subset_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Subset_ID") ) CREATE TABLE "Documents_in_Collections" ( "Document_Object_ID" INTEGER NOT NULL, "Collection_ID" INTEGER NOT NULL, PRIMARY KEY ("Document_Object_ID", "Collection_ID"), FOREIGN KEY("Document_Object_ID") REFERENCES "Document_Objects" ("Document_Object_ID"), FOREIGN KEY("Collection_ID") REFERENCES "Collections" ("Collection_ID") )
What are the names of the collections that are not the parent of the other collections?
hard
Table Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) Table Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) Table Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
SELECT Collection_Name FROM Collections EXCEPT SELECT Collections.Collection_Name FROM Collections JOIN Collections ON Collections.Parent_Collection_ID = Collections.Collection_ID;
{ 'collections': ['collection_id', 'parent_collection_id', 'collection_name'] }
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
Table Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) Table Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) Table Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) Table Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) Table Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) Table Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) Table Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
CREATE TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) CREATE TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) CREATE TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) CREATE TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) CREATE TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
Table collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) Table collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) Table collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) Table document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) Table document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) Table document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) Table documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
CREATE TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) CREATE TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) CREATE TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) CREATE TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) CREATE TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) CREATE TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) CREATE TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
{ 'Document_Subsets': ['Document_Subset_ID', 'Document_Subset_Name', 'Document_Subset_Details'], 'Collection_Subsets': ['Collection_Subset_ID', 'Collection_Subset_Name', 'Collecrtion_Subset_Details'], 'Document_Objects': ['Document_Object_ID', 'Parent_Document_Object_ID', 'Owner', 'Description', 'Other_Details'], 'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name', 'Collection_Description'], 'Documents_in_Collections': ['Document_Object_ID', 'Collection_ID'], 'Document_Subset_Members': ['Document_Object_ID', 'Related_Document_Object_ID', 'Document_Subset_ID'], 'Collection_Subset_Members': ['Collection_ID', 'Related_Collection_ID', 'Collection_Subset_ID'] }
{ 'Collections': ['Collection_ID', 'Parent_Collection_ID', 'Collection_Name'] }
TABLE Collection_Subset_Members ( Collection_Subset_Members.Collection_ID (INTEGER), Collection_Subset_Members.Related_Collection_ID (INTEGER), Collection_Subset_Members.Collection_Subset_ID (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.Collection_Subset_ID (INTEGER), Collection_Subsets.Collection_Subset_Name (VARCHAR(255)), Collection_Subsets.Collecrtion_Subset_Details (VARCHAR(255)), ) TABLE Collections ( Collections.Collection_ID (INTEGER), Collections.Parent_Collection_ID (INTEGER), Collections.Collection_Name (VARCHAR(255)), Collections.Collection_Description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.Document_Object_ID (INTEGER), Document_Objects.Parent_Document_Object_ID (INTEGER), Document_Objects.Owner (VARCHAR(255)), Document_Objects.Description (VARCHAR(255)), Document_Objects.Other_Details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.Document_Object_ID (INTEGER), Document_Subset_Members.Related_Document_Object_ID (INTEGER), Document_Subset_Members.Document_Subset_ID (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.Document_Subset_ID (INTEGER), Document_Subsets.Document_Subset_Name (VARCHAR(255)), Document_Subsets.Document_Subset_Details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.Document_Object_ID (INTEGER), Documents_in_Collections.Collection_ID (INTEGER), ) Possible JOINs: Collection_Subset_Members.Collection_ID = Collections.Collection_ID Collection_Subset_Members.Related_Collection_ID = Collections.Collection_ID Collection_Subset_Members.Collection_Subset_ID = Collection_Subsets.Collection_Subset_ID Document_Subset_Members.Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Related_Document_Object_ID = Document_Objects.Document_Object_ID Document_Subset_Members.Document_Subset_ID = Document_Subsets.Document_Subset_ID Documents_in_Collections.Document_Object_ID = Document_Objects.Document_Object_ID Documents_in_Collections.Collection_ID = Collections.Collection_ID
TABLE Collection_Subset_Members ( Collection_Subset_Members.collection_id (INTEGER), Collection_Subset_Members.related_collection_id (INTEGER), Collection_Subset_Members.collection_subset_id (INTEGER), ) TABLE Collection_Subsets ( Collection_Subsets.collection_subset_id (INTEGER), Collection_Subsets.collection_subset_name (VARCHAR(255)), Collection_Subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE Collections ( Collections.collection_id (INTEGER), Collections.parent_collection_id (INTEGER), Collections.collection_name (VARCHAR(255)), Collections.collection_description (VARCHAR(255)), ) TABLE Document_Objects ( Document_Objects.document_object_id (INTEGER), Document_Objects.parent_document_object_id (INTEGER), Document_Objects.owner (VARCHAR(255)), Document_Objects.description (VARCHAR(255)), Document_Objects.other_details (VARCHAR(255)), ) TABLE Document_Subset_Members ( Document_Subset_Members.document_object_id (INTEGER), Document_Subset_Members.related_document_object_id (INTEGER), Document_Subset_Members.document_subset_id (INTEGER), ) TABLE Document_Subsets ( Document_Subsets.document_subset_id (INTEGER), Document_Subsets.document_subset_name (VARCHAR(255)), Document_Subsets.document_subset_details (VARCHAR(255)), ) TABLE Documents_in_Collections ( Documents_in_Collections.document_object_id (INTEGER), Documents_in_Collections.collection_id (INTEGER), ) Possible JOINs: Collection_Subset_Members.collection_id = Collections.collection_id Collection_Subset_Members.related_collection_id = Collections.collection_id Collection_Subset_Members.collection_subset_id = Collection_Subsets.collection_subset_id Document_Subset_Members.document_object_id = Document_Objects.document_object_id Document_Subset_Members.related_document_object_id = Document_Objects.document_object_id Document_Subset_Members.document_subset_id = Document_Subsets.document_subset_id Documents_in_Collections.document_object_id = Document_Objects.document_object_id Documents_in_Collections.collection_id = Collections.collection_id
TABLE collection_subset_members ( collection_subset_members.collection_id (INTEGER), collection_subset_members.related_collection_id (INTEGER), collection_subset_members.collection_subset_id (INTEGER), ) TABLE collection_subsets ( collection_subsets.collection_subset_id (INTEGER), collection_subsets.collection_subset_name (VARCHAR(255)), collection_subsets.collecrtion_subset_details (VARCHAR(255)), ) TABLE collections ( collections.collection_id (INTEGER), collections.parent_collection_id (INTEGER), collections.collection_name (VARCHAR(255)), collections.collection_description (VARCHAR(255)), ) TABLE document_objects ( document_objects.document_object_id (INTEGER), document_objects.parent_document_object_id (INTEGER), document_objects.owner (VARCHAR(255)), document_objects.description (VARCHAR(255)), document_objects.other_details (VARCHAR(255)), ) TABLE document_subset_members ( document_subset_members.document_object_id (INTEGER), document_subset_members.related_document_object_id (INTEGER), document_subset_members.document_subset_id (INTEGER), ) TABLE document_subsets ( document_subsets.document_subset_id (INTEGER), document_subsets.document_subset_name (VARCHAR(255)), document_subsets.document_subset_details (VARCHAR(255)), ) TABLE documents_in_collections ( documents_in_collections.document_object_id (INTEGER), documents_in_collections.collection_id (INTEGER), ) Possible JOINs: collection_subset_members.collection_id = collections.collection_id collection_subset_members.related_collection_id = collections.collection_id collection_subset_members.collection_subset_id = collection_subsets.collection_subset_id document_subset_members.document_object_id = document_objects.document_object_id document_subset_members.related_document_object_id = document_objects.document_object_id document_subset_members.document_subset_id = document_subsets.document_subset_id documents_in_collections.document_object_id = document_objects.document_object_id documents_in_collections.collection_id = collections.collection_id
address_1
CREATE TABLE "City" ( city_code VARCHAR(3), city_name VARCHAR(25), state VARCHAR(2), country VARCHAR(25), latitude FLOAT, longitude FLOAT, PRIMARY KEY (city_code) ) CREATE TABLE "Direct_distance" ( city1_code VARCHAR(3), city2_code VARCHAR(3), distance INTEGER, FOREIGN KEY(city1_code) REFERENCES "City" (city_code), FOREIGN KEY(city2_code) REFERENCES "City" (city_code) ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID"), FOREIGN KEY(city_code) REFERENCES "City" (city_code) )
What are all the city names for cities in the USA, ordered by latitude?
medium
Table City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) Table Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) Table Student ( Student.StuID (INTEGER), Student.LName (VARCHAR(12)), Student.Fname (VARCHAR(12)), Student.Age (INTEGER), Student.Sex (VARCHAR(1)), Student.Major (INTEGER), Student.Advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
SELECT city_name FROM City WHERE country = "USA" ORDER BY latitude
{ 'city': ['city_code', 'city_name', 'country', 'latitude'] }
CREATE TABLE City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) CREATE TABLE Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) CREATE TABLE Student ( Student.StuID (INTEGER), Student.LName (VARCHAR(12)), Student.Fname (VARCHAR(12)), Student.Age (INTEGER), Student.Sex (VARCHAR(1)), Student.Major (INTEGER), Student.Advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
Table City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) Table Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) Table Student ( Student.stuid (INTEGER), Student.lname (VARCHAR(12)), Student.fname (VARCHAR(12)), Student.age (INTEGER), Student.sex (VARCHAR(1)), Student.major (INTEGER), Student.advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
CREATE TABLE City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) CREATE TABLE Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) CREATE TABLE Student ( Student.stuid (INTEGER), Student.lname (VARCHAR(12)), Student.fname (VARCHAR(12)), Student.age (INTEGER), Student.sex (VARCHAR(1)), Student.major (INTEGER), Student.advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
Table city ( city.city_code (VARCHAR(3)), city.city_name (VARCHAR(25)), city.state (VARCHAR(2)), city.country (VARCHAR(25)), city.latitude (FLOAT), city.longitude (FLOAT), ) Table direct_distance ( direct_distance.city1_code (varchar(3)), direct_distance.city2_code (varchar(3)), direct_distance.distance (INTEGER), ) Table student ( student.stuid (INTEGER), student.lname (VARCHAR(12)), student.fname (VARCHAR(12)), student.age (INTEGER), student.sex (VARCHAR(1)), student.major (INTEGER), student.advisor (INTEGER), student.city_code (VARCHAR(3)), ) Possible JOINs: direct_distance.city1_code = city.city_code direct_distance.city2_code = city.city_code student.city_code = city.city_code
CREATE TABLE city ( city.city_code (VARCHAR(3)), city.city_name (VARCHAR(25)), city.state (VARCHAR(2)), city.country (VARCHAR(25)), city.latitude (FLOAT), city.longitude (FLOAT), ) CREATE TABLE direct_distance ( direct_distance.city1_code (varchar(3)), direct_distance.city2_code (varchar(3)), direct_distance.distance (INTEGER), ) CREATE TABLE student ( student.stuid (INTEGER), student.lname (VARCHAR(12)), student.fname (VARCHAR(12)), student.age (INTEGER), student.sex (VARCHAR(1)), student.major (INTEGER), student.advisor (INTEGER), student.city_code (VARCHAR(3)), ) Possible JOINs: direct_distance.city1_code = city.city_code direct_distance.city2_code = city.city_code student.city_code = city.city_code
{ 'Student': ['StuID', 'LName', 'Fname', 'Age', 'Sex', 'Major', 'Advisor', 'city_code'], 'Direct_distance': ['city1_code', 'city2_code', 'distance'], 'City': ['city_code', 'city_name', 'state', 'country', 'latitude', 'longitude'] }
{ 'City': ['city_code', 'city_name', 'country', 'latitude'] }
TABLE City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) TABLE Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) TABLE Student ( Student.StuID (INTEGER), Student.LName (VARCHAR(12)), Student.Fname (VARCHAR(12)), Student.Age (INTEGER), Student.Sex (VARCHAR(1)), Student.Major (INTEGER), Student.Advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
TABLE City ( City.city_code (VARCHAR(3)), City.city_name (VARCHAR(25)), City.state (VARCHAR(2)), City.country (VARCHAR(25)), City.latitude (FLOAT), City.longitude (FLOAT), ) TABLE Direct_distance ( Direct_distance.city1_code (varchar(3)), Direct_distance.city2_code (varchar(3)), Direct_distance.distance (INTEGER), ) TABLE Student ( Student.stuid (INTEGER), Student.lname (VARCHAR(12)), Student.fname (VARCHAR(12)), Student.age (INTEGER), Student.sex (VARCHAR(1)), Student.major (INTEGER), Student.advisor (INTEGER), Student.city_code (VARCHAR(3)), ) Possible JOINs: Direct_distance.city1_code = City.city_code Direct_distance.city2_code = City.city_code Student.city_code = City.city_code
TABLE city ( city.city_code (VARCHAR(3)), city.city_name (VARCHAR(25)), city.state (VARCHAR(2)), city.country (VARCHAR(25)), city.latitude (FLOAT), city.longitude (FLOAT), ) TABLE direct_distance ( direct_distance.city1_code (varchar(3)), direct_distance.city2_code (varchar(3)), direct_distance.distance (INTEGER), ) TABLE student ( student.stuid (INTEGER), student.lname (VARCHAR(12)), student.fname (VARCHAR(12)), student.age (INTEGER), student.sex (VARCHAR(1)), student.major (INTEGER), student.advisor (INTEGER), student.city_code (VARCHAR(3)), ) Possible JOINs: direct_distance.city1_code = city.city_code direct_distance.city2_code = city.city_code student.city_code = city.city_code
advertising_agencies
CREATE TABLE "Agencies" ( agency_id INTEGER, agency_details VARCHAR(255) NOT NULL, PRIMARY KEY (agency_id) ) CREATE TABLE "Clients" ( client_id INTEGER, agency_id INTEGER NOT NULL, sic_code VARCHAR(10) NOT NULL, client_details VARCHAR(255) NOT NULL, PRIMARY KEY (client_id), FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id) ) CREATE TABLE "Invoices" ( invoice_id INTEGER, client_id INTEGER NOT NULL, invoice_status VARCHAR(10) NOT NULL, invoice_details VARCHAR(255) NOT NULL, PRIMARY KEY (invoice_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Meetings" ( meeting_id INTEGER, client_id INTEGER NOT NULL, meeting_outcome VARCHAR(10) NOT NULL, meeting_type VARCHAR(10) NOT NULL, billable_yn VARCHAR(1), start_date_time DATETIME, end_date_time DATETIME, purpose_of_meeting VARCHAR(255), other_details VARCHAR(255) NOT NULL, PRIMARY KEY (meeting_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Payments" ( payment_id INTEGER NOT NULL, invoice_id INTEGER NOT NULL, payment_details VARCHAR(255) NOT NULL, FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, agency_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_in_Meetings" ( meeting_id INTEGER NOT NULL, staff_id INTEGER NOT NULL, FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id) )
Show all client ids and the number of invoices for each client.
medium
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
SELECT client_id , count(*) FROM Invoices GROUP BY client_id
{ 'invoices': ['invoice_id', 'client_id'] }
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) Table clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) Table invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) Table meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) Table payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) Table staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) Table staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
CREATE TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) CREATE TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) CREATE TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) CREATE TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) CREATE TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) CREATE TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
{ 'Agencies': ['agency_id', 'agency_details'], 'Staff': ['staff_id', 'agency_id', 'staff_details'], 'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'], 'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'], 'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'], 'Payments': ['payment_id', 'invoice_id', 'payment_details'], 'Staff_in_Meetings': ['meeting_id', 'staff_id'] }
{ 'Invoices': ['invoice_id', 'client_id'] }
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
customers_and_orders
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_date DATETIME NOT NULL, order_status_code VARCHAR(15), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, address_id INTEGER NOT NULL, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(80), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE, PRIMARY KEY (product_id) )
Show all product type codes and the average price for each type.
medium
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
SELECT product_type_code , avg(product_price) FROM Products GROUP BY product_type_code
{ 'products': ['product_id', 'product_type_code', 'product_price'] }
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) Table customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) Table customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) Table products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
CREATE TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) CREATE TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) CREATE TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
{ 'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'], 'Addresses': ['address_id', 'address_details'], 'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'], 'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'], 'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity'] }
{ 'Products': ['product_id', 'product_type_code', 'product_price'] }
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
book_1
CREATE TABLE Client (IdClient CHAR(10) PRIMARY KEY, Name VARCHAR(25) NOT NULL, Address VARCHAR(60) NOT NULL, NumCC CHAR(16) NOT NULL) /* 0 rows from Client table: IdClient Name Address NumCC */ CREATE TABLE Orders (IdOrder CHAR(10) PRIMARY KEY, IdClient CHAR(10) NOT NULL REFERENCES Client on delete cascade, DateOrder DATE, DateExped DATE) /* 0 rows from Orders table: IdOrder IdClient DateOrder DateExped */ CREATE TABLE Author ( idAuthor NUMBER PRIMARY KEY, Name VARCHAR(25)) /* 0 rows from Author table: idAuthor Name */ CREATE TABLE Book (ISBN CHAR(15) PRIMARY KEY, Title VARCHAR(60) NOT NULL, Author CHAR(4) NOT NULL, PurchasePrice NUMBER(6,2) DEFAULT 0, SalePrice NUMBER(6,2) DEFAULT 0) /* 0 rows from Book table: ISBN Title Author PurchasePrice SalePrice */ CREATE TABLE Author_Book (ISBN CHAR(15), Author NUMBER, CONSTRAINT al_PK PRIMARY KEY (ISBN, Author), CONSTRAINT BookA_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade, CONSTRAINT Author_FK FOREIGN KEY (Author) REFERENCES `Author`(idAuthorA)) /* 0 rows from Author_Book table: ISBN Author */ CREATE TABLE Books_Order( ISBN CHAR(15), IdOrder CHAR(10), amount NUMBER(3) CHECK (amount >0), CONSTRAINT lp_PK PRIMARY KEY (ISBN, idOrder), CONSTRAINT Book_FK FOREIGN KEY (ISBN) REFERENCES `Book`(ISBN) on delete cascade, CONSTRAINT pedido_FK FOREIGN KEY (IdOrder) REFERENCES `Orders`(IdOrder) on delete cascade) /* 0 rows from Books_Order table: ISBN IdOrder amount */
What is the maximum and the minimum sale price?
medium
Table Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) Table Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) Table Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) Table Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) Table Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) Table Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
SELECT max(saleprice) , min(saleprice) FROM Book
{ 'book': ['isbn', 'saleprice'] }
CREATE TABLE Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) CREATE TABLE Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) CREATE TABLE Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) CREATE TABLE Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) CREATE TABLE Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) CREATE TABLE Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
Table Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) Table Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) Table Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) Table Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) Table Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) Table Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
CREATE TABLE Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) CREATE TABLE Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) CREATE TABLE Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) CREATE TABLE Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) CREATE TABLE Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) CREATE TABLE Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
Table author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) Table author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) Table book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) Table books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) Table client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) Table orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
CREATE TABLE author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) CREATE TABLE author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) CREATE TABLE book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) CREATE TABLE books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) CREATE TABLE client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) CREATE TABLE orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
{ 'Client': ['IdClient', 'Name', 'Address', 'NumCC'], 'Orders': ['IdOrder', 'IdClient', 'DateOrder', 'DateExped'], 'Author': ['idAuthor', 'Name'], 'Book': ['ISBN', 'Title', 'Author', 'PurchasePrice', 'SalePrice'], 'Author_Book': ['ISBN', 'Author'], 'Books_Order': ['ISBN', 'IdOrder', 'amount'] }
{ 'Book': ['ISBN', 'SalePrice'] }
TABLE Author ( Author.idAuthor (NUMBER), Author.Name (VARCHAR(25)), ) TABLE Author_Book ( Author_Book.ISBN (CHAR(15)), Author_Book.Author (NUMBER), ) TABLE Book ( Book.ISBN (CHAR(15)), Book.Title (VARCHAR(60)), Book.Author (CHAR(4)), Book.PurchasePrice (NUMBER(6,2)), Book.SalePrice (NUMBER(6,2)), ) TABLE Books_Order ( Books_Order.ISBN (CHAR(15)), Books_Order.IdOrder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) TABLE Client ( Client.IdClient (CHAR(10)), Client.Name (VARCHAR(25)), Client.Address (VARCHAR(60)), Client.NumCC (CHAR(16)), ) TABLE Orders ( Orders.IdOrder (CHAR(10)), Orders.IdClient (CHAR(10)), Orders.DateOrder (DATE), Orders.DateExped (DATE), ) Possible JOINs: Author_Book.ISBN = Book.ISBN Author_Book.Author = Author.idAuthorA Books_Order.ISBN = Book.ISBN Books_Order.IdOrder = Orders.IdOrder Orders.IdClient = Client.IdClient
TABLE Author ( Author.idauthor (NUMBER), Author.name (VARCHAR(25)), ) TABLE Author_Book ( Author_Book.isbn (CHAR(15)), Author_Book.author (NUMBER), ) TABLE Book ( Book.isbn (CHAR(15)), Book.title (VARCHAR(60)), Book.author (CHAR(4)), Book.purchaseprice (NUMBER(6,2)), Book.saleprice (NUMBER(6,2)), ) TABLE Books_Order ( Books_Order.isbn (CHAR(15)), Books_Order.idorder (CHAR(10)), Books_Order.amount (NUMBER(3)), ) TABLE Client ( Client.idclient (CHAR(10)), Client.name (VARCHAR(25)), Client.address (VARCHAR(60)), Client.numcc (CHAR(16)), ) TABLE Orders ( Orders.idorder (CHAR(10)), Orders.idclient (CHAR(10)), Orders.dateorder (DATE), Orders.dateexped (DATE), ) Possible JOINs: Author_Book.isbn = Book.isbn Author_Book.author = Author.idauthora Books_Order.isbn = Book.isbn Books_Order.idorder = Orders.idorder Orders.idclient = Client.idclient
TABLE author ( author.idauthor (NUMBER), author.name (VARCHAR(25)), ) TABLE author_book ( author_book.isbn (CHAR(15)), author_book.author (NUMBER), ) TABLE book ( book.isbn (CHAR(15)), book.title (VARCHAR(60)), book.author (CHAR(4)), book.purchaseprice (NUMBER(6,2)), book.saleprice (NUMBER(6,2)), ) TABLE books_order ( books_order.isbn (CHAR(15)), books_order.idorder (CHAR(10)), books_order.amount (NUMBER(3)), ) TABLE client ( client.idclient (CHAR(10)), client.name (VARCHAR(25)), client.address (VARCHAR(60)), client.numcc (CHAR(16)), ) TABLE orders ( orders.idorder (CHAR(10)), orders.idclient (CHAR(10)), orders.dateorder (DATE), orders.dateexped (DATE), ) Possible JOINs: author_book.isbn = book.isbn author_book.author = author.idauthora books_order.isbn = book.isbn books_order.idorder = orders.idorder orders.idclient = client.idclient
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") )
What is the three most popular goods in this bakery?
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 item FROM items GROUP BY item ORDER BY COUNT (*) DESC LIMIT 3
{ 'items': ['receipt', 'item'] }
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'] }
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
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 */
What are the starting time and ending time of each detention record?
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 datetime_detention_start , datetime_detention_end FROM Detention
{ 'detention': ['detention_id', 'datetime_detention_start', 'datetime_detention_end'] }
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'] }
{ 'Detention': ['detention_id', 'datetime_detention_start', 'datetime_detention_end'] }
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
headphone_store
CREATE TABLE headphone ( "Headphone_ID" INTEGER, "Model" TEXT, "Class" TEXT, "Driver-matched_dB" REAL, "Construction" TEXT, "Earpads" TEXT, "Price" INTEGER, PRIMARY KEY ("Headphone_ID") ) CREATE TABLE stock ( "Store_ID" INTEGER, "Headphone_ID" INTEGER, "Quantity" INTEGER, PRIMARY KEY ("Store_ID", "Headphone_ID"), FOREIGN KEY("Headphone_ID") REFERENCES headphone ("Headphone_ID"), FOREIGN KEY("Store_ID") REFERENCES store ("Store_ID") ) CREATE TABLE store ( "Store_ID" INTEGER, "Name" TEXT, "Neighborhood" TEXT, "Parking" TEXT, "Date_Opened" TEXT, PRIMARY KEY ("Store_ID") )
Which neighborhood does not have any headphone in stock?
hard
Table headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) Table stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) Table store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
SELECT Neighborhood FROM store EXCEPT SELECT store.Neighborhood FROM store JOIN stock ON store.store_id = stock.store_id
{ 'store': ['store_id', 'neighborhood'], 'stock': ['store_id'] }
CREATE TABLE headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) CREATE TABLE stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) CREATE TABLE store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
Table headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) Table stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) Table store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
CREATE TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) CREATE TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) CREATE TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
Table headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) Table stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) Table store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
CREATE TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) CREATE TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) CREATE TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
{ 'headphone': ['Headphone_ID', 'Model', 'Class', 'Driver-matched_dB', 'Construction', 'Earpads', 'Price'], 'store': ['Store_ID', 'Name', 'Neighborhood', 'Parking', 'Date_Opened'], 'stock': ['Store_ID', 'Headphone_ID', 'Quantity'] }
{ 'store': ['Store_ID', 'Neighborhood'], 'stock': ['Store_ID'] }
TABLE headphone ( headphone.Headphone_ID (INT), headphone.Model (TEXT), headphone.Class (TEXT), headphone.Driver-matched_dB (REAL), headphone.Construction (TEXT), headphone.Earpads (TEXT), headphone.Price (INT), ) TABLE stock ( stock.Store_ID (INT), stock.Headphone_ID (INT), stock.Quantity (INT), ) TABLE store ( store.Store_ID (INT), store.Name (TEXT), store.Neighborhood (TEXT), store.Parking (TEXT), store.Date_Opened (TEXT), ) Possible JOINs: stock.Store_ID = store.Store_ID stock.Headphone_ID = headphone.Headphone_ID
TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
TABLE headphone ( headphone.headphone_id (INT), headphone.model (TEXT), headphone.class (TEXT), headphone.driver-matched_db (REAL), headphone.construction (TEXT), headphone.earpads (TEXT), headphone.price (INT), ) TABLE stock ( stock.store_id (INT), stock.headphone_id (INT), stock.quantity (INT), ) TABLE store ( store.store_id (INT), store.name (TEXT), store.neighborhood (TEXT), store.parking (TEXT), store.date_opened (TEXT), ) Possible JOINs: stock.store_id = store.store_id stock.headphone_id = headphone.headphone_id
customers_and_orders
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_date DATETIME NOT NULL, order_status_code VARCHAR(15), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, address_id INTEGER NOT NULL, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(80), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE, PRIMARY KEY (product_id) )
Show the order ids, order dates, and order status codes for all orders by customer Jeromy.
medium
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
SELECT order_id , order_date , order_status_code FROM Customer_orders JOIN Customers ON Customer_orders.customer_id = Customers.customer_id WHERE Customers.customer_name = "Jeromy"
{ 'customer_orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'], 'customers': ['customer_id', 'customer_name'] }
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) Table Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) Table Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) Table Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
CREATE TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) CREATE TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) CREATE TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) CREATE TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
Table addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) Table customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) Table customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) Table order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) Table products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
CREATE TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) CREATE TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) CREATE TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) CREATE TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
{ 'Products': ['product_id', 'product_type_code', 'product_name', 'product_price'], 'Addresses': ['address_id', 'address_details'], 'Customers': ['customer_id', 'address_id', 'payment_method_code', 'customer_number', 'customer_name', 'customer_address', 'customer_phone', 'customer_email'], 'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'], 'Order_Items': ['order_item_id', 'order_id', 'product_id', 'order_quantity'] }
{ 'Customer_Orders': ['order_id', 'customer_id', 'order_date', 'order_status_code'], 'Customers': ['customer_id', 'customer_name'] }
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE Addresses ( Addresses.address_id (INTEGER), Addresses.address_details (VARCHAR(255)), ) TABLE Customer_Orders ( Customer_Orders.order_id (INTEGER), Customer_Orders.customer_id (INTEGER), Customer_Orders.order_date (DATETIME), Customer_Orders.order_status_code (VARCHAR(15)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.address_id (INTEGER), Customers.payment_method_code (VARCHAR(15)), Customers.customer_number (VARCHAR(20)), Customers.customer_name (VARCHAR(80)), Customers.customer_address (VARCHAR(255)), Customers.customer_phone (VARCHAR(80)), Customers.customer_email (VARCHAR(80)), ) TABLE Order_Items ( Order_Items.order_item_id (INTEGER), Order_Items.order_id (INTEGER), Order_Items.product_id (INTEGER), Order_Items.order_quantity (VARCHAR(80)), ) TABLE Products ( Products.product_id (INTEGER), Products.product_type_code (VARCHAR(15)), Products.product_name (VARCHAR(80)), Products.product_price (DOUBLE), ) Possible JOINs: Customer_Orders.customer_id = Customers.customer_id Order_Items.order_id = Customer_Orders.order_id Order_Items.product_id = Products.product_id
TABLE addresses ( addresses.address_id (INTEGER), addresses.address_details (VARCHAR(255)), ) TABLE customer_orders ( customer_orders.order_id (INTEGER), customer_orders.customer_id (INTEGER), customer_orders.order_date (DATETIME), customer_orders.order_status_code (VARCHAR(15)), ) TABLE customers ( customers.customer_id (INTEGER), customers.address_id (INTEGER), customers.payment_method_code (VARCHAR(15)), customers.customer_number (VARCHAR(20)), customers.customer_name (VARCHAR(80)), customers.customer_address (VARCHAR(255)), customers.customer_phone (VARCHAR(80)), customers.customer_email (VARCHAR(80)), ) TABLE order_items ( order_items.order_item_id (INTEGER), order_items.order_id (INTEGER), order_items.product_id (INTEGER), order_items.order_quantity (VARCHAR(80)), ) TABLE products ( products.product_id (INTEGER), products.product_type_code (VARCHAR(15)), products.product_name (VARCHAR(80)), products.product_price (DOUBLE), ) Possible JOINs: customer_orders.customer_id = customers.customer_id order_items.order_id = customer_orders.order_id order_items.product_id = products.product_id
government_shift
CREATE TABLE "Analytical_Layer" ( "Analytical_ID" INTEGER NOT NULL, "Customers_and_Services_ID" VARCHAR(40) NOT NULL, "Pattern_Recognition" VARCHAR(255) NOT NULL, "Analytical_Layer_Type_Code" CHAR(15), PRIMARY KEY ("Analytical_ID"), FOREIGN KEY("Customers_and_Services_ID") REFERENCES "Customers_and_Services" ("Customers_and_Services_ID") ) CREATE TABLE "Channels" ( "Channel_ID" INTEGER NOT NULL, "Channel_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Channel_ID") ) CREATE TABLE "Customer_Interactions" ( "Customer_Interaction_ID" INTEGER NOT NULL, "Channel_ID" INTEGER, "Customer_ID" INTEGER, "Service_ID" INTEGER, "Status_Code" CHAR(15), "Services_and_Channels_Details" VARCHAR(255), PRIMARY KEY ("Customer_Interaction_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Channel_ID") REFERENCES "Channels" ("Channel_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Customers" ( "Customer_ID" INTEGER NOT NULL, "Customer_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Customer_ID") ) CREATE TABLE "Customers_and_Services" ( "Customers_and_Services_ID" INTEGER NOT NULL, "Customer_ID" INTEGER, "Service_ID" INTEGER, "Customers_and_Services_Details" CHAR(15) NOT NULL, PRIMARY KEY ("Customers_and_Services_ID"), FOREIGN KEY("Service_ID") REFERENCES "Services" ("Service_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Integration_Platform" ( "Integration_Platform_ID" INTEGER NOT NULL, "Customer_Interaction_ID" INTEGER NOT NULL, "Integration_Platform_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Integration_Platform_ID"), FOREIGN KEY("Customer_Interaction_ID") REFERENCES "Customer_Interactions" ("Customer_Interaction_ID") ) CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_Details" VARCHAR(255), PRIMARY KEY ("Service_ID") )
Find the details of the customers who have used the least-used service .
extra
Table Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) Table Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) Table Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) Table Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) Table Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) Table Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) Table Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
SELECT DISTINCT customers.customer_details FROM customers JOIN customers_and_services ON customers.customer_id = customers_and_services.customer_id WHERE customers_and_services.service_id = (SELECT service_id FROM services GROUP BY service_id ORDER BY count(*) ASC LIMIT 1)
{ 'customers': ['customer_id', 'customer_details'], 'customers_and_services': ['customers_and_services_id', 'customer_id', 'service_id'], 'services': ['service_id'] }
CREATE TABLE Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) CREATE TABLE Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) CREATE TABLE Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) CREATE TABLE Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) CREATE TABLE Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) CREATE TABLE Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) CREATE TABLE Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
Table Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) Table Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) Table Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) Table Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) Table Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) Table Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) Table Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
CREATE TABLE Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) CREATE TABLE Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) CREATE TABLE Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) CREATE TABLE Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) CREATE TABLE Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) CREATE TABLE Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) CREATE TABLE Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
Table analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) Table channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) Table customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) Table customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) Table customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) Table integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) Table services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
CREATE TABLE analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) CREATE TABLE channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) CREATE TABLE customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) CREATE TABLE customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) CREATE TABLE customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) CREATE TABLE integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) CREATE TABLE services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_id
{ 'Services': ['Service_ID', 'Service_Details'], 'Customers': ['Customer_ID', 'Customer_Details'], 'Channels': ['Channel_ID', 'Channel_Details'], 'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID', 'Customers_and_Services_Details'], 'Customer_Interactions': ['Customer_Interaction_ID', 'Channel_ID', 'Customer_ID', 'Service_ID', 'Status_Code', 'Services_and_Channels_Details'], 'Integration_Platform': ['Integration_Platform_ID', 'Customer_Interaction_ID', 'Integration_Platform_Details'], 'Analytical_Layer': ['Analytical_ID', 'Customers_and_Services_ID', 'Pattern_Recognition', 'Analytical_Layer_Type_Code'] }
{ 'Customers': ['Customer_ID', 'Customer_Details'], 'Customers_and_Services': ['Customers_and_Services_ID', 'Customer_ID', 'Service_ID'], 'Services': ['Service_ID'] }
TABLE Analytical_Layer ( Analytical_Layer.Analytical_ID (INTEGER), Analytical_Layer.Customers_and_Services_ID (VARCHAR(40)), Analytical_Layer.Pattern_Recognition (VARCHAR(255)), Analytical_Layer.Analytical_Layer_Type_Code (CHAR(15)), ) TABLE Channels ( Channels.Channel_ID (INTEGER), Channels.Channel_Details (VARCHAR(255)), ) TABLE Customer_Interactions ( Customer_Interactions.Customer_Interaction_ID (INTEGER), Customer_Interactions.Channel_ID (INTEGER), Customer_Interactions.Customer_ID (INTEGER), Customer_Interactions.Service_ID (INTEGER), Customer_Interactions.Status_Code (CHAR(15)), Customer_Interactions.Services_and_Channels_Details (VARCHAR(255)), ) TABLE Customers ( Customers.Customer_ID (INTEGER), Customers.Customer_Details (VARCHAR(255)), ) TABLE Customers_and_Services ( Customers_and_Services.Customers_and_Services_ID (INTEGER), Customers_and_Services.Customer_ID (INTEGER), Customers_and_Services.Service_ID (INTEGER), Customers_and_Services.Customers_and_Services_Details (CHAR(15)), ) TABLE Integration_Platform ( Integration_Platform.Integration_Platform_ID (INTEGER), Integration_Platform.Customer_Interaction_ID (INTEGER), Integration_Platform.Integration_Platform_Details (VARCHAR(255)), ) TABLE Services ( Services.Service_ID (INTEGER), Services.Service_Details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.Customers_and_Services_ID = Customers_and_Services.Customers_and_Services_ID Customer_Interactions.Channel_ID = Channels.Channel_ID Customer_Interactions.Customer_ID = Customers.Customer_ID Customer_Interactions.Service_ID = Services.Service_ID Customers_and_Services.Customer_ID = Customers.Customer_ID Customers_and_Services.Service_ID = Services.Service_ID Integration_Platform.Customer_Interaction_ID = Customer_Interactions.Customer_Interaction_ID
TABLE Analytical_Layer ( Analytical_Layer.analytical_id (INTEGER), Analytical_Layer.customers_and_services_id (VARCHAR(40)), Analytical_Layer.pattern_recognition (VARCHAR(255)), Analytical_Layer.analytical_layer_type_code (CHAR(15)), ) TABLE Channels ( Channels.channel_id (INTEGER), Channels.channel_details (VARCHAR(255)), ) TABLE Customer_Interactions ( Customer_Interactions.customer_interaction_id (INTEGER), Customer_Interactions.channel_id (INTEGER), Customer_Interactions.customer_id (INTEGER), Customer_Interactions.service_id (INTEGER), Customer_Interactions.status_code (CHAR(15)), Customer_Interactions.services_and_channels_details (VARCHAR(255)), ) TABLE Customers ( Customers.customer_id (INTEGER), Customers.customer_details (VARCHAR(255)), ) TABLE Customers_and_Services ( Customers_and_Services.customers_and_services_id (INTEGER), Customers_and_Services.customer_id (INTEGER), Customers_and_Services.service_id (INTEGER), Customers_and_Services.customers_and_services_details (CHAR(15)), ) TABLE Integration_Platform ( Integration_Platform.integration_platform_id (INTEGER), Integration_Platform.customer_interaction_id (INTEGER), Integration_Platform.integration_platform_details (VARCHAR(255)), ) TABLE Services ( Services.service_id (INTEGER), Services.service_details (VARCHAR(255)), ) Possible JOINs: Analytical_Layer.customers_and_services_id = Customers_and_Services.customers_and_services_id Customer_Interactions.channel_id = Channels.channel_id Customer_Interactions.customer_id = Customers.customer_id Customer_Interactions.service_id = Services.service_id Customers_and_Services.customer_id = Customers.customer_id Customers_and_Services.service_id = Services.service_id Integration_Platform.customer_interaction_id = Customer_Interactions.customer_interaction_id
TABLE analytical_layer ( analytical_layer.analytical_id (INTEGER), analytical_layer.customers_and_services_id (VARCHAR(40)), analytical_layer.pattern_recognition (VARCHAR(255)), analytical_layer.analytical_layer_type_code (CHAR(15)), ) TABLE channels ( channels.channel_id (INTEGER), channels.channel_details (VARCHAR(255)), ) TABLE customer_interactions ( customer_interactions.customer_interaction_id (INTEGER), customer_interactions.channel_id (INTEGER), customer_interactions.customer_id (INTEGER), customer_interactions.service_id (INTEGER), customer_interactions.status_code (CHAR(15)), customer_interactions.services_and_channels_details (VARCHAR(255)), ) TABLE customers ( customers.customer_id (INTEGER), customers.customer_details (VARCHAR(255)), ) TABLE customers_and_services ( customers_and_services.customers_and_services_id (INTEGER), customers_and_services.customer_id (INTEGER), customers_and_services.service_id (INTEGER), customers_and_services.customers_and_services_details (CHAR(15)), ) TABLE integration_platform ( integration_platform.integration_platform_id (INTEGER), integration_platform.customer_interaction_id (INTEGER), integration_platform.integration_platform_details (VARCHAR(255)), ) TABLE services ( services.service_id (INTEGER), services.service_details (VARCHAR(255)), ) Possible JOINs: analytical_layer.customers_and_services_id = customers_and_services.customers_and_services_id customer_interactions.channel_id = channels.channel_id customer_interactions.customer_id = customers.customer_id customer_interactions.service_id = services.service_id customers_and_services.customer_id = customers.customer_id customers_and_services.service_id = services.service_id integration_platform.customer_interaction_id = customer_interactions.customer_interaction_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 movie is playing at both the Odeon and Imperial theater?
extra
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 movies.title FROM movies JOIN movietheaters ON movies.code = movietheaters.movie WHERE movietheaters.name = 'Odeon' INTERSECT SELECT movies.title FROM movies JOIN movietheaters ON movies.code = movietheaters.movie WHERE movietheaters.name = 'Imperial'
{ 'movies': ['code', 'title'], 'movietheaters': ['code', 'name', 'movie'] }
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'], 'MovieTheaters': ['Code', 'Name', 'Movie'] }
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
conference
CREATE TABLE conference ( "Conference_ID" INTEGER, "Conference_Name" TEXT, "Year" INTEGER, "Location" TEXT, PRIMARY KEY ("Conference_ID") ) CREATE TABLE conference_participation ( "Conference_ID" INTEGER, "staff_ID" INTEGER, role TEXT, PRIMARY KEY ("staff_ID", "Conference_ID"), FOREIGN KEY("Conference_ID") REFERENCES conference ("Conference_ID"), FOREIGN KEY("staff_ID") REFERENCES staff ("staff_ID") ) CREATE TABLE institution ( "Institution_ID" INTEGER, "Institution_Name" TEXT, "Location" TEXT, "Founded" INTEGER, PRIMARY KEY ("Institution_ID") ) CREATE TABLE staff ( "staff_ID" INTEGER, name TEXT, "Age" INTEGER, "Nationality" TEXT, "Institution_ID" INTEGER, PRIMARY KEY ("staff_ID"), FOREIGN KEY("Institution_ID") REFERENCES institution ("Institution_ID") )
Show all staff names who attend a conference in 2003 or 2004.
extra
Table conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) Table conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) Table institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) Table staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
SELECT DISTINCT staff.name FROM staff JOIN conference_participation JOIN Conference ON staff.staff_id = conference_participation.staff_id AND conference_participation.conference_id = Conference.conference_id WHERE Conference.year = 2003 OR Conference.year = 2004
{ 'staff': ['staff_id', 'name'], 'conference_participation': ['conference_id', 'staff_id'], 'conference': ['conference_id', 'year'] }
CREATE TABLE conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) CREATE TABLE staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
Table conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) Table conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) Table institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) Table staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
CREATE TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) CREATE TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
Table conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) Table conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) Table institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) Table staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
CREATE TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) CREATE TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) CREATE TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) CREATE TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
{ 'conference': ['Conference_ID', 'Conference_Name', 'Year', 'Location'], 'institution': ['Institution_ID', 'Institution_Name', 'Location', 'Founded'], 'staff': ['staff_ID', 'name', 'Age', 'Nationality', 'Institution_ID'], 'conference_participation': ['Conference_ID', 'staff_ID', 'role'] }
{ 'staff': ['staff_ID', 'name'], 'conference_participation': ['Conference_ID', 'staff_ID'], 'conference': ['Conference_ID', 'Year'] }
TABLE conference ( conference.Conference_ID (INT), conference.Conference_Name (TEXT), conference.Year (INT), conference.Location (TEXT), ) TABLE conference_participation ( conference_participation.Conference_ID (INT), conference_participation.staff_ID (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.Institution_ID (INT), institution.Institution_Name (TEXT), institution.Location (TEXT), institution.Founded (INT), ) TABLE staff ( staff.staff_ID (INT), staff.name (TEXT), staff.Age (INT), staff.Nationality (TEXT), staff.Institution_ID (INT), ) Possible JOINs: conference_participation.Conference_ID = conference.Conference_ID conference_participation.staff_ID = staff.staff_ID staff.Institution_ID = institution.Institution_ID
TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
TABLE conference ( conference.conference_id (INT), conference.conference_name (TEXT), conference.year (INT), conference.location (TEXT), ) TABLE conference_participation ( conference_participation.conference_id (INT), conference_participation.staff_id (INT), conference_participation.role (TEXT), ) TABLE institution ( institution.institution_id (INT), institution.institution_name (TEXT), institution.location (TEXT), institution.founded (INT), ) TABLE staff ( staff.staff_id (INT), staff.name (TEXT), staff.age (INT), staff.nationality (TEXT), staff.institution_id (INT), ) Possible JOINs: conference_participation.conference_id = conference.conference_id conference_participation.staff_id = staff.staff_id staff.institution_id = institution.institution_id
vehicle_driver
CREATE TABLE driver ( "Driver_ID" INTEGER, "Name" TEXT, "Citizenship" TEXT, "Racing_Series" TEXT, PRIMARY KEY ("Driver_ID") ) CREATE TABLE vehicle ( "Vehicle_ID" INTEGER, "Model" TEXT, "Build_Year" TEXT, "Top_Speed" INTEGER, "Power" INTEGER, "Builder" TEXT, "Total_Production" TEXT, PRIMARY KEY ("Vehicle_ID") ) CREATE TABLE vehicle_driver ( "Driver_ID" INTEGER, "Vehicle_ID" INTEGER, PRIMARY KEY ("Driver_ID", "Vehicle_ID"), FOREIGN KEY("Driver_ID") REFERENCES driver ("Driver_ID"), FOREIGN KEY("Vehicle_ID") REFERENCES vehicle ("Vehicle_ID") )
Return the names of drivers with citizenship from the United States.
easy
Table driver ( driver.Driver_ID (INT), driver.Name (TEXT), driver.Citizenship (TEXT), driver.Racing_Series (TEXT), ) Table vehicle ( vehicle.Vehicle_ID (INT), vehicle.Model (TEXT), vehicle.Build_Year (TEXT), vehicle.Top_Speed (INT), vehicle.Power (INT), vehicle.Builder (TEXT), vehicle.Total_Production (TEXT), ) Table vehicle_driver ( vehicle_driver.Driver_ID (INT), vehicle_driver.Vehicle_ID (INT), ) Possible JOINs: vehicle_driver.Driver_ID = driver.Driver_ID vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
SELECT name FROM driver WHERE citizenship = 'United States'
{ 'driver': ['driver_id', 'name', 'citizenship'] }
CREATE TABLE driver ( driver.Driver_ID (INT), driver.Name (TEXT), driver.Citizenship (TEXT), driver.Racing_Series (TEXT), ) CREATE TABLE vehicle ( vehicle.Vehicle_ID (INT), vehicle.Model (TEXT), vehicle.Build_Year (TEXT), vehicle.Top_Speed (INT), vehicle.Power (INT), vehicle.Builder (TEXT), vehicle.Total_Production (TEXT), ) CREATE TABLE vehicle_driver ( vehicle_driver.Driver_ID (INT), vehicle_driver.Vehicle_ID (INT), ) Possible JOINs: vehicle_driver.Driver_ID = driver.Driver_ID vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
Table driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) Table vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) Table vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
CREATE TABLE driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) CREATE TABLE vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) CREATE TABLE vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
Table driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) Table vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) Table vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
CREATE TABLE driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) CREATE TABLE vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) CREATE TABLE vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
{ 'vehicle': ['Vehicle_ID', 'Model', 'Build_Year', 'Top_Speed', 'Power', 'Builder', 'Total_Production'], 'driver': ['Driver_ID', 'Name', 'Citizenship', 'Racing_Series'], 'vehicle_driver': ['Driver_ID', 'Vehicle_ID'] }
{ 'driver': ['Driver_ID', 'Name', 'Citizenship'] }
TABLE driver ( driver.Driver_ID (INT), driver.Name (TEXT), driver.Citizenship (TEXT), driver.Racing_Series (TEXT), ) TABLE vehicle ( vehicle.Vehicle_ID (INT), vehicle.Model (TEXT), vehicle.Build_Year (TEXT), vehicle.Top_Speed (INT), vehicle.Power (INT), vehicle.Builder (TEXT), vehicle.Total_Production (TEXT), ) TABLE vehicle_driver ( vehicle_driver.Driver_ID (INT), vehicle_driver.Vehicle_ID (INT), ) Possible JOINs: vehicle_driver.Driver_ID = driver.Driver_ID vehicle_driver.Vehicle_ID = vehicle.Vehicle_ID
TABLE driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) TABLE vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) TABLE vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
TABLE driver ( driver.driver_id (INT), driver.name (TEXT), driver.citizenship (TEXT), driver.racing_series (TEXT), ) TABLE vehicle ( vehicle.vehicle_id (INT), vehicle.model (TEXT), vehicle.build_year (TEXT), vehicle.top_speed (INT), vehicle.power (INT), vehicle.builder (TEXT), vehicle.total_production (TEXT), ) TABLE vehicle_driver ( vehicle_driver.driver_id (INT), vehicle_driver.vehicle_id (INT), ) Possible JOINs: vehicle_driver.driver_id = driver.driver_id vehicle_driver.vehicle_id = vehicle.vehicle_id
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) )
What is the name and age of the sailor with maximum age?
extra
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 name , age FROM Sailors WHERE age = ( SELECT max(age) FROM Sailors )
{ 'sailors': ['sid', 'name', 'age'] }
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', 'age'] }
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
vehicle_rent
CREATE TABLE "Customers" ( id INTEGER, name TEXT, age INTEGER, membership_credit INTEGER, PRIMARY KEY (id) ) CREATE TABLE "Discount" ( id INTEGER, name TEXT, membership_credit INTEGER, PRIMARY KEY (id) ) CREATE TABLE "Renting_history" ( id INTEGER, customer_id INTEGER, discount_id INTEGER, vehicles_id INTEGER, total_hours INTEGER, PRIMARY KEY (id), FOREIGN KEY(customer_id) REFERENCES "Customers" (id), FOREIGN KEY(vehicles_id) REFERENCES "Vehicles" (id), FOREIGN KEY(discount_id) REFERENCES "Discount" (id) ) CREATE TABLE "Vehicles" ( id INTEGER, name TEXT, "Model_year" INTEGER, "Type_of_powertrain" TEXT, "Combined_fuel_economy_rate" INTEGER, "City_fuel_economy_rate" INTEGER, "Highway_fuel_economy_rate" INTEGER, "Cost_per_25_miles" REAL, "Annual_fuel_cost" REAL, "Notes" TEXT, PRIMARY KEY (id) )
Show name, type of powertrain, and annual fuel cost for all vehicles with model year 2013 or 2014.
extra
Table Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) Table Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) Table Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) Table Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.Model_year (INT), Vehicles.Type_of_powertrain (TEXT), Vehicles.Combined_fuel_economy_rate (INT), Vehicles.City_fuel_economy_rate (INT), Vehicles.Highway_fuel_economy_rate (INT), Vehicles.Cost_per_25_miles (REAL), Vehicles.Annual_fuel_cost (REAL), Vehicles.Notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
SELECT name , type_of_powertrain , annual_fuel_cost FROM vehicles WHERE model_year = 2013 OR model_year = 2014
{ 'vehicles': ['id', 'name', 'model_year', 'type_of_powertrain', 'annual_fuel_cost'] }
CREATE TABLE Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) CREATE TABLE Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) CREATE TABLE Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) CREATE TABLE Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.Model_year (INT), Vehicles.Type_of_powertrain (TEXT), Vehicles.Combined_fuel_economy_rate (INT), Vehicles.City_fuel_economy_rate (INT), Vehicles.Highway_fuel_economy_rate (INT), Vehicles.Cost_per_25_miles (REAL), Vehicles.Annual_fuel_cost (REAL), Vehicles.Notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
Table Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) Table Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) Table Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) Table Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.model_year (INT), Vehicles.type_of_powertrain (TEXT), Vehicles.combined_fuel_economy_rate (INT), Vehicles.city_fuel_economy_rate (INT), Vehicles.highway_fuel_economy_rate (INT), Vehicles.cost_per_25_miles (REAL), Vehicles.annual_fuel_cost (REAL), Vehicles.notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
CREATE TABLE Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) CREATE TABLE Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) CREATE TABLE Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) CREATE TABLE Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.model_year (INT), Vehicles.type_of_powertrain (TEXT), Vehicles.combined_fuel_economy_rate (INT), Vehicles.city_fuel_economy_rate (INT), Vehicles.highway_fuel_economy_rate (INT), Vehicles.cost_per_25_miles (REAL), Vehicles.annual_fuel_cost (REAL), Vehicles.notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
Table customers ( customers.id (INT), customers.name (TEXT), customers.age (INT), customers.membership_credit (INT), ) Table discount ( discount.id (INT), discount.name (TEXT), discount.membership_credit (INT), ) Table renting_history ( renting_history.id (INT), renting_history.customer_id (INT), renting_history.discount_id (INT), renting_history.vehicles_id (INT), renting_history.total_hours (INT), ) Table vehicles ( vehicles.id (INT), vehicles.name (TEXT), vehicles.model_year (INT), vehicles.type_of_powertrain (TEXT), vehicles.combined_fuel_economy_rate (INT), vehicles.city_fuel_economy_rate (INT), vehicles.highway_fuel_economy_rate (INT), vehicles.cost_per_25_miles (REAL), vehicles.annual_fuel_cost (REAL), vehicles.notes (TEXT), ) Possible JOINs: renting_history.customer_id = customers.id renting_history.discount_id = discount.id renting_history.vehicles_id = vehicles.id
CREATE TABLE customers ( customers.id (INT), customers.name (TEXT), customers.age (INT), customers.membership_credit (INT), ) CREATE TABLE discount ( discount.id (INT), discount.name (TEXT), discount.membership_credit (INT), ) CREATE TABLE renting_history ( renting_history.id (INT), renting_history.customer_id (INT), renting_history.discount_id (INT), renting_history.vehicles_id (INT), renting_history.total_hours (INT), ) CREATE TABLE vehicles ( vehicles.id (INT), vehicles.name (TEXT), vehicles.model_year (INT), vehicles.type_of_powertrain (TEXT), vehicles.combined_fuel_economy_rate (INT), vehicles.city_fuel_economy_rate (INT), vehicles.highway_fuel_economy_rate (INT), vehicles.cost_per_25_miles (REAL), vehicles.annual_fuel_cost (REAL), vehicles.notes (TEXT), ) Possible JOINs: renting_history.customer_id = customers.id renting_history.discount_id = discount.id renting_history.vehicles_id = vehicles.id
{ 'Customers': ['id', 'name', 'age', 'membership_credit'], 'Discount': ['id', 'name', 'membership_credit'], 'Vehicles': ['id', 'name', 'Model_year', 'Type_of_powertrain', 'Combined_fuel_economy_rate', 'City_fuel_economy_rate', 'Highway_fuel_economy_rate', 'Cost_per_25_miles', 'Annual_fuel_cost', 'Notes'], 'Renting_history': ['id', 'customer_id', 'discount_id', 'vehicles_id', 'total_hours'] }
{ 'Vehicles': ['id', 'name', 'Model_year', 'Type_of_powertrain', 'Annual_fuel_cost'] }
TABLE Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) TABLE Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) TABLE Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) TABLE Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.Model_year (INT), Vehicles.Type_of_powertrain (TEXT), Vehicles.Combined_fuel_economy_rate (INT), Vehicles.City_fuel_economy_rate (INT), Vehicles.Highway_fuel_economy_rate (INT), Vehicles.Cost_per_25_miles (REAL), Vehicles.Annual_fuel_cost (REAL), Vehicles.Notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
TABLE Customers ( Customers.id (INT), Customers.name (TEXT), Customers.age (INT), Customers.membership_credit (INT), ) TABLE Discount ( Discount.id (INT), Discount.name (TEXT), Discount.membership_credit (INT), ) TABLE Renting_history ( Renting_history.id (INT), Renting_history.customer_id (INT), Renting_history.discount_id (INT), Renting_history.vehicles_id (INT), Renting_history.total_hours (INT), ) TABLE Vehicles ( Vehicles.id (INT), Vehicles.name (TEXT), Vehicles.model_year (INT), Vehicles.type_of_powertrain (TEXT), Vehicles.combined_fuel_economy_rate (INT), Vehicles.city_fuel_economy_rate (INT), Vehicles.highway_fuel_economy_rate (INT), Vehicles.cost_per_25_miles (REAL), Vehicles.annual_fuel_cost (REAL), Vehicles.notes (TEXT), ) Possible JOINs: Renting_history.customer_id = Customers.id Renting_history.discount_id = Discount.id Renting_history.vehicles_id = Vehicles.id
TABLE customers ( customers.id (INT), customers.name (TEXT), customers.age (INT), customers.membership_credit (INT), ) TABLE discount ( discount.id (INT), discount.name (TEXT), discount.membership_credit (INT), ) TABLE renting_history ( renting_history.id (INT), renting_history.customer_id (INT), renting_history.discount_id (INT), renting_history.vehicles_id (INT), renting_history.total_hours (INT), ) TABLE vehicles ( vehicles.id (INT), vehicles.name (TEXT), vehicles.model_year (INT), vehicles.type_of_powertrain (TEXT), vehicles.combined_fuel_economy_rate (INT), vehicles.city_fuel_economy_rate (INT), vehicles.highway_fuel_economy_rate (INT), vehicles.cost_per_25_miles (REAL), vehicles.annual_fuel_cost (REAL), vehicles.notes (TEXT), ) Possible JOINs: renting_history.customer_id = customers.id renting_history.discount_id = discount.id renting_history.vehicles_id = vehicles.id
advertising_agencies
CREATE TABLE "Agencies" ( agency_id INTEGER, agency_details VARCHAR(255) NOT NULL, PRIMARY KEY (agency_id) ) CREATE TABLE "Clients" ( client_id INTEGER, agency_id INTEGER NOT NULL, sic_code VARCHAR(10) NOT NULL, client_details VARCHAR(255) NOT NULL, PRIMARY KEY (client_id), FOREIGN KEY(agency_id) REFERENCES "Agencies" (agency_id) ) CREATE TABLE "Invoices" ( invoice_id INTEGER, client_id INTEGER NOT NULL, invoice_status VARCHAR(10) NOT NULL, invoice_details VARCHAR(255) NOT NULL, PRIMARY KEY (invoice_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Meetings" ( meeting_id INTEGER, client_id INTEGER NOT NULL, meeting_outcome VARCHAR(10) NOT NULL, meeting_type VARCHAR(10) NOT NULL, billable_yn VARCHAR(1), start_date_time DATETIME, end_date_time DATETIME, purpose_of_meeting VARCHAR(255), other_details VARCHAR(255) NOT NULL, PRIMARY KEY (meeting_id), FOREIGN KEY(client_id) REFERENCES "Clients" (client_id) ) CREATE TABLE "Payments" ( payment_id INTEGER NOT NULL, invoice_id INTEGER NOT NULL, payment_details VARCHAR(255) NOT NULL, FOREIGN KEY(invoice_id) REFERENCES "Invoices" (invoice_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, agency_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_in_Meetings" ( meeting_id INTEGER NOT NULL, staff_id INTEGER NOT NULL, FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(meeting_id) REFERENCES "Meetings" (meeting_id) )
How many agencies do we have?
easy
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
SELECT count(*) FROM Agencies
{ 'agencies': ['agency_id'] }
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) Table Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) Table Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) Table Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) Table Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) Table Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) Table Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
CREATE TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) CREATE TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) CREATE TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) CREATE TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) CREATE TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) CREATE TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
Table agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) Table clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) Table invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) Table meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) Table payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) Table staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) Table staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
CREATE TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) CREATE TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) CREATE TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) CREATE TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) CREATE TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) CREATE TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) CREATE TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_id
{ 'Agencies': ['agency_id', 'agency_details'], 'Staff': ['staff_id', 'agency_id', 'staff_details'], 'Clients': ['client_id', 'agency_id', 'sic_code', 'client_details'], 'Invoices': ['invoice_id', 'client_id', 'invoice_status', 'invoice_details'], 'Meetings': ['meeting_id', 'client_id', 'meeting_outcome', 'meeting_type', 'billable_yn', 'start_date_time', 'end_date_time', 'purpose_of_meeting', 'other_details'], 'Payments': ['payment_id', 'invoice_id', 'payment_details'], 'Staff_in_Meetings': ['meeting_id', 'staff_id'] }
{ 'Agencies': ['agency_id'] }
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE Agencies ( Agencies.agency_id (INTEGER), Agencies.agency_details (VARCHAR(255)), ) TABLE Clients ( Clients.client_id (INTEGER), Clients.agency_id (INTEGER), Clients.sic_code (VARCHAR(10)), Clients.client_details (VARCHAR(255)), ) TABLE Invoices ( Invoices.invoice_id (INTEGER), Invoices.client_id (INTEGER), Invoices.invoice_status (VARCHAR(10)), Invoices.invoice_details (VARCHAR(255)), ) TABLE Meetings ( Meetings.meeting_id (INTEGER), Meetings.client_id (INTEGER), Meetings.meeting_outcome (VARCHAR(10)), Meetings.meeting_type (VARCHAR(10)), Meetings.billable_yn (VARCHAR(1)), Meetings.start_date_time (DATETIME), Meetings.end_date_time (DATETIME), Meetings.purpose_of_meeting (VARCHAR(255)), Meetings.other_details (VARCHAR(255)), ) TABLE Payments ( Payments.payment_id (INTEGER), Payments.invoice_id (INTEGER), Payments.payment_details (VARCHAR(255)), ) TABLE Staff ( Staff.staff_id (INTEGER), Staff.agency_id (INTEGER), Staff.staff_details (VARCHAR(255)), ) TABLE Staff_in_Meetings ( Staff_in_Meetings.meeting_id (INTEGER), Staff_in_Meetings.staff_id (INTEGER), ) Possible JOINs: Clients.agency_id = Agencies.agency_id Invoices.client_id = Clients.client_id Meetings.client_id = Clients.client_id Payments.invoice_id = Invoices.invoice_id Staff_in_Meetings.meeting_id = Meetings.meeting_id Staff_in_Meetings.staff_id = Staff.staff_id
TABLE agencies ( agencies.agency_id (INTEGER), agencies.agency_details (VARCHAR(255)), ) TABLE clients ( clients.client_id (INTEGER), clients.agency_id (INTEGER), clients.sic_code (VARCHAR(10)), clients.client_details (VARCHAR(255)), ) TABLE invoices ( invoices.invoice_id (INTEGER), invoices.client_id (INTEGER), invoices.invoice_status (VARCHAR(10)), invoices.invoice_details (VARCHAR(255)), ) TABLE meetings ( meetings.meeting_id (INTEGER), meetings.client_id (INTEGER), meetings.meeting_outcome (VARCHAR(10)), meetings.meeting_type (VARCHAR(10)), meetings.billable_yn (VARCHAR(1)), meetings.start_date_time (DATETIME), meetings.end_date_time (DATETIME), meetings.purpose_of_meeting (VARCHAR(255)), meetings.other_details (VARCHAR(255)), ) TABLE payments ( payments.payment_id (INTEGER), payments.invoice_id (INTEGER), payments.payment_details (VARCHAR(255)), ) TABLE staff ( staff.staff_id (INTEGER), staff.agency_id (INTEGER), staff.staff_details (VARCHAR(255)), ) TABLE staff_in_meetings ( staff_in_meetings.meeting_id (INTEGER), staff_in_meetings.staff_id (INTEGER), ) Possible JOINs: clients.agency_id = agencies.agency_id invoices.client_id = clients.client_id meetings.client_id = clients.client_id payments.invoice_id = invoices.invoice_id staff_in_meetings.meeting_id = meetings.meeting_id staff_in_meetings.staff_id = staff.staff_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 names of all cinemas not showing any movies?
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 DISTINCT name FROM MovieTheaters WHERE Movie = 'null'
{ 'movietheaters': ['code', 'name', 'movie'] }
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'] }
{ 'MovieTheaters': ['Code', 'Name', 'Movie'] }
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
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") )
Return the names of institutions, as well as their nicknames.
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 institution.Name , championship.Nickname FROM championship JOIN institution ON championship.Institution_ID = institution.Institution_ID
{ 'championship': ['institution_id', 'nickname'], 'institution': ['institution_id', 'name'] }
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'] }
{ 'Championship': ['Institution_ID', 'Nickname'], 'institution': ['Institution_ID', 'Name'] }
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_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) )
Show the number of process status.
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 Process_status
{ 'process_status': ['process_status_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
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'] }
{ 'Process_Status': ['process_status_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
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