Datasets:

Modalities:
Text
Formats:
parquet
Size:
< 1K
Libraries:
Datasets
pandas
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
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
35
Edit dataset card