db_id
stringclasses 127
values | query
stringlengths 20
523
| question
stringlengths 16
224
| schema
stringclasses 127
values |
---|---|---|---|
cre_Theme_park | SELECT T1.Name , T1.Description FROM PHOTOS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T2.Name = "film festival" | Find the names and descriptions of the photos taken at the tourist attraction called "film festival". | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Royal_Family_Details , T2.How_to_Get_There FROM ROYAL_FAMILY AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Royal_Family_ID = T2.Tourist_Attraction_ID | What are the details and ways to get to tourist attractions related to royal family? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Royal_Family_Details , T2.How_to_Get_There FROM ROYAL_FAMILY AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Royal_Family_ID = T2.Tourist_Attraction_ID | Which tourist attractions are related to royal family? Tell me their details and how we can get there. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Shop_Details FROM SHOPS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Shop_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = "walk" | What are the details of the shops that can be accessed by walk? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Shop_Details FROM SHOPS AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Shop_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = "walk" | Find the details of the shops that can be reached by walk. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM STAFF AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T2.Name = "US museum" | What is the name of the staff that is in charge of the attraction named "US museum"? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM STAFF AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID WHERE T2.Name = "US museum" | Tell me the name of the staff in charge of the attraction called "US museum". | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Market_Details FROM Street_Markets AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Market_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = "walk" OR T2.How_to_Get_There = "bus" | What are the details of the markets that can be accessed by walk or bus? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Market_Details FROM Street_Markets AS T1 JOIN TOURIST_ATTRACTIONS AS T2 ON T1.Market_ID = T2.Tourist_Attraction_ID WHERE T2.How_to_Get_There = "walk" OR T2.How_to_Get_There = "bus" | Find the details of all the markets that are accessible by walk or bus. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T2.Visit_Date , T2.Visit_Details FROM VISITORS AS T1 JOIN VISITS AS T2 ON T1.Tourist_ID = T2.Tourist_ID WHERE T1.Tourist_Details = "Vincent" | What are the visit date and details of the visitor whose detail is 'Vincent'? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T2.Visit_Date , T2.Visit_Details FROM VISITORS AS T1 JOIN VISITS AS T2 ON T1.Tourist_ID = T2.Tourist_ID WHERE T1.Tourist_Details = "Vincent" | Find the visit date and details of the tourist whose detail is 'Vincent' | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN VISITORS AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T3.Tourist_Details = "Vincent" | Which tourist attractions does the visitor with detail 'Vincent' visit? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN VISITORS AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T3.Tourist_Details = "Vincent" | Show the tourist attractions visited by the tourist whose detail is 'Vincent'. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name , T3.Visit_Date FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Vincent" OR T2.Tourist_Details = "Vivian" | What are the names of the tourist attractions and the dates when the tourists named Vincent or Vivian visited there? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name , T3.Visit_Date FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Vincent" OR T2.Tourist_Details = "Vivian" | For each tourist attraction, return its name and the date when the tourists named Vincent or Vivian visited there. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT star_rating_code , avg(price_range) FROM HOTELS GROUP BY star_rating_code | Show the average price of hotels for each star rating code. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT star_rating_code , avg(price_range) FROM HOTELS GROUP BY star_rating_code | What is the average price range of hotels for each each star rating code? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT pets_allowed_yn , avg(price_range) FROM HOTELS GROUP BY pets_allowed_yn | Show the average price of hotels for different pet policy. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT pets_allowed_yn , avg(price_range) FROM HOTELS GROUP BY pets_allowed_yn | What are the average prices of hotels grouped by their pet policy. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT hotel_id , star_rating_code FROM HOTELS ORDER BY price_range ASC | Show the id and star rating of each hotel, ordered by its price from low to high. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT hotel_id , star_rating_code FROM HOTELS ORDER BY price_range ASC | Find the id and star rating of each hotel and sort them in increasing order of price. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT other_hotel_details FROM HOTELS ORDER BY price_range DESC LIMIT 3 | Show the details of the top 3 most expensive hotels. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT other_hotel_details FROM HOTELS ORDER BY price_range DESC LIMIT 3 | What are the details of the three most expensive hotels? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT other_hotel_details , star_rating_code FROM HOTELS ORDER BY price_range ASC LIMIT 3 | Show the details and star ratings of the 3 least expensive hotels. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT other_hotel_details , star_rating_code FROM HOTELS ORDER BY price_range ASC LIMIT 3 | What are the details and star ratings of the three hotels with the lowest price ranges? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT How_to_Get_There FROM Tourist_Attractions GROUP BY How_to_Get_There ORDER BY COUNT(*) DESC LIMIT 1 | Show the transportation method most people choose to get to tourist attractions. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT How_to_Get_There FROM Tourist_Attractions GROUP BY How_to_Get_There ORDER BY COUNT(*) DESC LIMIT 1 | Which transportation method is used the most often to get to tourist attractions? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Attraction_Type_Description , T2.Attraction_Type_Code FROM Ref_Attraction_Types AS T1 JOIN Tourist_Attractions AS T2 ON T1.Attraction_Type_Code = T2.Attraction_Type_Code GROUP BY T2.Attraction_Type_Code ORDER BY COUNT(*) DESC LIMIT 1 | Show the description and code of the attraction type most tourist attractions belong to. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Attraction_Type_Description , T2.Attraction_Type_Code FROM Ref_Attraction_Types AS T1 JOIN Tourist_Attractions AS T2 ON T1.Attraction_Type_Code = T2.Attraction_Type_Code GROUP BY T2.Attraction_Type_Code ORDER BY COUNT(*) DESC LIMIT 1 | Which attraction type does the most tourist attractions belong to? Tell me its attraction type description and code. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT How_to_Get_There , COUNT(*) FROM Tourist_Attractions GROUP BY How_to_Get_There | Show different ways to get to attractions and the number of attractions that can be accessed in the corresponding way. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT How_to_Get_There , COUNT(*) FROM Tourist_Attractions GROUP BY How_to_Get_There | List all the possible ways to get to attractions, together with the number of attractions accessible by these methods. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name , T2.Tourist_Attraction_ID , COUNT(*) FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID | Show different tourist attractions' names, ids, and the corresponding number of visits. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name , T2.Tourist_Attraction_ID , COUNT(*) FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID | What are the name, id and the corresponding number of visits for each tourist attraction? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name , T2.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING count(*) >= 2 | Show the names and ids of tourist attractions that are visited at least two times. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name , T2.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING count(*) >= 2 | Which tourist attractions are visited at least twice? Give me their names and ids. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name , T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING count(*) <= 1 | Show the names and ids of tourist attractions that are visited at most once. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name , T1.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING count(*) <= 1 | What are the names and ids of the tourist attractions that are visited at most once? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "660 Shea Crescent" OR T2.How_to_Get_There = "walk" | What are the names of tourist attractions that can be reached by walk or is at address 660 Shea Crescent? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "660 Shea Crescent" OR T2.How_to_Get_There = "walk" | Find the names of the tourist attractions that is either accessible by walk or at address 660 Shea Crescent. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'park' UNION SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'shopping' | What are the names of the tourist attractions that have parking or shopping as their feature details? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'park' UNION SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN Tourist_Attraction_Features AS T2 ON T1.tourist_attraction_id = T2.tourist_attraction_id JOIN Features AS T3 ON T2.Feature_ID = T3.Feature_ID WHERE T3.feature_Details = 'shopping' | Find the tourist attractions that have parking or shopping as their feature details. What are the names of the attractions? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "254 Ottilie Junction" OR T2.How_to_Get_There = "bus" | What are the names of tourist attractions that can be reached by bus or is at address 254 Ottilie Junction? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = "254 Ottilie Junction" OR T2.How_to_Get_There = "bus" | Find the names of the tourist attractions that is either accessible by bus or at address 254 Ottilie Junction. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Vincent" INTERSECT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Marcelle" | What are the names of the tourist attractions Vincent and Marcelle visit? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Vincent" INTERSECT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Marcelle" | Which tourist attractions do the tourists Vincent and Marcelle visit? Tell me the names of the attractions. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Alison" EXCEPT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Rosalind" | What are the names of tourist attraction that Alison visited but Rosalind did not visit? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Alison" EXCEPT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = "Rosalind" | Find the the names of the tourist attractions that the tourist named Alison visited but Rosalind did not visit. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT count(*) FROM Visitors WHERE Tourist_ID NOT IN ( SELECT Tourist_ID FROM Visits ) | How many tourists did not make any visit? | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
cre_Theme_park | SELECT count(*) FROM Visitors WHERE Tourist_ID NOT IN ( SELECT Tourist_ID FROM Visits ) | Count the number of tourists who did not visit any place. | CREATE TABLE Ref_Hotel_Star_Ratings (
star_rating_code CHAR(15) NOT NULL,
star_rating_description VARCHAR(80),
PRIMARY KEY (star_rating_code),
UNIQUE (star_rating_code)
);
CREATE TABLE Locations (
Location_ID INTEGER NOT NULL,
Location_Name VARCHAR(255),
Address VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Location_ID)
);
CREATE TABLE Ref_Attraction_Types (
Attraction_Type_Code CHAR(15) NOT NULL,
Attraction_Type_Description VARCHAR(255),
PRIMARY KEY (Attraction_Type_Code),
UNIQUE (Attraction_Type_Code)
);
CREATE TABLE Visitors (
Tourist_ID INTEGER NOT NULL,
Tourist_Details VARCHAR(255),
PRIMARY KEY (Tourist_ID),
UNIQUE (Tourist_ID)
);
CREATE TABLE Features (
Feature_ID INTEGER NOT NULL,
Feature_Details VARCHAR(255),
PRIMARY KEY (Feature_ID)
);
CREATE TABLE Hotels (
hotel_id INTEGER NOT NULL,
star_rating_code CHAR(15) NOT NULL,
pets_allowed_yn CHAR(1),
price_range real,
other_hotel_details VARCHAR(255),
PRIMARY KEY (hotel_id),
FOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)
);
CREATE TABLE Tourist_Attractions (
Tourist_Attraction_ID INTEGER NOT NULL,
Attraction_Type_Code CHAR(15) NOT NULL,
Location_ID INTEGER NOT NULL,
How_to_Get_There VARCHAR(255),
Name VARCHAR(255),
Description VARCHAR(255),
Opening_Hours VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Tourist_Attraction_ID),
FOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),
FOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)
);
CREATE TABLE Street_Markets (
Market_ID INTEGER NOT NULL,
Market_Details VARCHAR(255),
PRIMARY KEY (Market_ID),
FOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Shops (
Shop_ID INTEGER NOT NULL,
Shop_Details VARCHAR(255),
PRIMARY KEY (Shop_ID),
FOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Museums (
Museum_ID INTEGER NOT NULL,
Museum_Details VARCHAR(255),
PRIMARY KEY (Museum_ID),
FOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Royal_Family (
Royal_Family_ID INTEGER NOT NULL,
Royal_Family_Details VARCHAR(255),
PRIMARY KEY (Royal_Family_ID),
FOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Theme_Parks (
Theme_Park_ID INTEGER NOT NULL,
Theme_Park_Details VARCHAR(255),
PRIMARY KEY (Theme_Park_ID),
FOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Visits (
Visit_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Tourist_ID INTEGER NOT NULL,
Visit_Date DATETIME NOT NULL,
Visit_Details VARCHAR(40) NOT NULL,
PRIMARY KEY (Visit_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)
);
CREATE TABLE Photos (
Photo_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(255),
Description VARCHAR(255),
Filename VARCHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Photo_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Staff (
Staff_ID INTEGER NOT NULL,
Tourist_Attraction_ID INTEGER NOT NULL,
Name VARCHAR(40),
Other_Details VARCHAR(255),
PRIMARY KEY (Staff_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)
);
CREATE TABLE Tourist_Attraction_Features (
Tourist_Attraction_ID INTEGER NOT NULL,
Feature_ID INTEGER NOT NULL,
PRIMARY KEY (Tourist_Attraction_ID, Feature_ID),
FOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),
FOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)
);
INSERT INTO Locations (`Location_ID`, `Location_Name`, `Address`, `Other_Details`) VALUES (333, 'Astro Orbiter', '660 Shea Crescent', NULL)
INSERT INTO Ref_Attraction_Types (`Attraction_Type_Code`, `Attraction_Type_Description`) VALUES ('2', 'park')
INSERT INTO Ref_Hotel_Star_Ratings (`star_rating_code`, `star_rating_description`) VALUES ('1', 'star')
INSERT INTO Visitors (`Tourist_ID`, `Tourist_Details`) VALUES (164, 'Toney')
INSERT INTO Features (`Feature_ID`, `Feature_Details`) VALUES (523, 'cafe')
INSERT INTO Hotels (`hotel_id`, `star_rating_code`, `pets_allowed_yn`, `price_range`, `other_hotel_details`) VALUES (123, '5', '1', '2914989.571', NULL)
INSERT INTO Tourist_Attractions (`Tourist_Attraction_ID`, `Attraction_Type_Code`, `Location_ID`, `How_to_Get_There`, `Name`, `Description`, `Opening_Hours`, `Other_Details`) VALUES (2113, '2', 579, 'bus', 'art museum', NULL, NULL, NULL)
INSERT INTO Museums (`Museum_ID`,`Museum_Details`) VALUES (2113,'Yale Center for British Art')
INSERT INTO Theme_Parks (`Theme_Park_ID`,`Theme_Park_Details`) VALUES (5265,'Disney')
INSERT INTO Street_Markets (`Market_ID`,`Market_Details`) VALUES (6852, 'Broadway')
INSERT INTO Shops (`Shop_ID`,`Shop_Details`) VALUES (8429, 'soup')
INSERT INTO Royal_Family (`Royal_Family_ID`,`Royal_Family_Details`) VALUES (9561,NULL)
INSERT INTO Visits (`Visit_ID`, `Tourist_Attraction_ID`, `Tourist_ID`, `Visit_Date`, `Visit_Details`) VALUES (183, 6653, 377, '2004-08-21 03:06:14', '')
INSERT INTO Photos (`Photo_ID`, `Tourist_Attraction_ID`, `Name`, `Description`, `Filename`, `Other_Details`) VALUES (211, 8449, 'game1', NULL, '702', NULL)
INSERT INTO Staff (`Staff_ID`, `Tourist_Attraction_ID`, `Name`, `Other_Details`) VALUES (170, 6476, 'Whitney', NULL)
INSERT INTO Tourist_Attraction_Features (`Tourist_Attraction_ID`, `Feature_ID`) VALUES (5076, 528) |
game_1 | SELECT count(*) FROM Video_games | How many video games exist? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(*) FROM Video_games | How many video games do you have? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(DISTINCT gtype) FROM Video_games | How many video game types exist? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(DISTINCT gtype) FROM Video_games | What is the count of different game types? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT DISTINCT gtype FROM Video_games | Show all video game types. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT DISTINCT gtype FROM Video_games | What are the different types of video games? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gname , gtype FROM Video_games ORDER BY gname | Show all video games and their types in the order of their names. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gname , gtype FROM Video_games ORDER BY gname | What are the names of all the video games and their types in alphabetical order? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gname FROM Video_games WHERE gtype = "Collectible card game" | Show all video games with type Collectible card game. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gname FROM Video_games WHERE gtype = "Collectible card game" | What are the names of all video games that are collectible cards? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gtype FROM Video_games WHERE gname = "Call of Destiny" | What is the type of video game Call of Destiny. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gtype FROM Video_games WHERE gname = "Call of Destiny" | What type of game is Call of Destiny? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(*) FROM Video_games WHERE gtype = "Massively multiplayer online game" | How many video games have type Massively multiplayer online game? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(*) FROM Video_games WHERE gtype = "Massively multiplayer online game" | Count the number of video games with Massively multiplayer online game type . | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gtype , count(*) FROM Video_games GROUP BY gtype | Show all video game types and the number of video games in each type. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gtype , count(*) FROM Video_games GROUP BY gtype | What are the types of video games and how many are in each type? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) DESC LIMIT 1 | Which game type has most number of games? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) DESC LIMIT 1 | What type has the most games? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) LIMIT 1 | Which game type has least number of games? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT gtype FROM Video_games GROUP BY gtype ORDER BY count(*) LIMIT 1 | What is the type with the fewest games? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID FROM Student WHERE city_code = "CHI" | Show ids for all students who live in CHI. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID FROM Student WHERE city_code = "CHI" | What are the ids of all students who live in CHI? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID FROM Student WHERE Advisor = 1121 | Show ids for all students who have advisor 1121. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID FROM Student WHERE Advisor = 1121 | What are the ids of all students who have advisor number 1121? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT Fname FROM Student WHERE Major = 600 | Show first name for all students with major 600. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT Fname FROM Student WHERE Major = 600 | What are the first names for all students who are from the major numbered 600? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT major , avg(age) , min(age) , max(age) FROM Student GROUP BY major | Show the average, minimum, and maximum age for different majors. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT major , avg(age) , min(age) , max(age) FROM Student GROUP BY major | What are the average, minimum, and max ages for each of the different majors? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT advisor FROM Student GROUP BY advisor HAVING count(*) >= 2 | Show all advisors who have at least two students. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT advisor FROM Student GROUP BY advisor HAVING count(*) >= 2 | What are the advisors | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(DISTINCT sportname) FROM Sportsinfo | How many sports do we have? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(DISTINCT sportname) FROM Sportsinfo | How many different types of sports do we offer? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(DISTINCT StuID) FROM Sportsinfo | How many students play sports? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT count(DISTINCT StuID) FROM Sportsinfo | How many different students are involved in sports? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y' | List ids for all student who are on scholarship. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID FROM Sportsinfo WHERE onscholarship = 'Y' | What are the ids for all sporty students who are on scholarship? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y' | Show last names for all student who are on scholarship. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y' | What are the last names for all scholarship students? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT sum(gamesplayed) FROM Sportsinfo | How many games are played for all students? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT sum(gamesplayed) FROM Sportsinfo | What is the total number of games played? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y' | How many games are played for all football games by students on scholarship? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT sum(gamesplayed) FROM Sportsinfo WHERE sportname = "Football" AND onscholarship = 'Y' | What is the total number of all football games played by scholarship students? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname | Show all sport name and the number of students. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT sportname , count(*) FROM Sportsinfo GROUP BY sportname | How many students play each sport? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID | Show all student IDs with the number of sports and total number of games played | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID | What are the ids of all students along with how many sports and games did they play? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek) > 10 | Show all student IDs with more than total 10 hours per week on all sports played. | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT StuID FROM Sportsinfo GROUP BY StuID HAVING sum(hoursperweek) > 10 | What are the student IDs for everybody who worked for more than 10 hours per week on all sports? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1 | What is the first name and last name of the student who have most number of sports? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1 | What is the first and last name of the student who played the most sports? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |
game_1 | SELECT sportname FROM Sportsinfo WHERE onscholarship = 'Y' GROUP BY sportname ORDER BY count(*) DESC LIMIT 1 | Which sport has most number of students on scholarship? | create table Student (
StuID INTEGER PRIMARY KEY,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
);
create table Video_Games (
GameID INTEGER PRIMARY KEY,
GName VARCHAR(40),
GType VARCHAR(40)
);
create table Plays_Games (
StuID INTEGER,
GameID INTEGER,
Hours_Played INTEGER,
FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
create table SportsInfo (
StuID INTEGER,
SportName VARCHAR(32),
HoursPerWeek INTEGER,
GamesPlayed INTEGER,
OnScholarship VARCHAR(1),
FOREIGN KEY(StuID) REFERENCES Student(StuID)
);
INSERT into Student values ( 1001, 'Smith', 'Linda', 18, 'F', 600, 1121,'BAL');
INSERT into Video_Games values ( 1, 'RNG Stone', 'Collectible card game');
INSERT into Plays_Games values ( 1001, 1, 35);
INSERT INTO SportsInfo VALUES (1001, "Athletics", 2, 5, "N"); |