db_id stringclasses 146 values | question stringlengths 3 224 | sql stringlengths 18 577 | database_schema stringclasses 146 values |
|---|---|---|---|
twitter_1 | Find the maximum and total number of followers of all users. | SELECT max(followers) , sum(followers) FROM user_profiles | CREATE TABLE `follows` (
`f1` int(11) NOT NULL,
`f2` int(11) NOT NULL,
PRIMARY KEY (`f1`,`f2`),
FOREIGN KEY (`f1`) REFERENCES `user_profiles`(`uid`),
FOREIGN KEY (`f2`) REFERENCES `user_profiles`(`uid`)
)
3 rows from follows table:
f1 f2
1 2
2 3
7 1
CREATE TABLE `tweets` (
`id` bigint(20) NOT NULL,
`uid` int(11) NOT NULL,
`text` char(140) NOT NULL,
`createdate` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
FOREIGN KEY (`uid`) REFERENCES `user_profiles`(`uid`)
)
3 rows from tweets table:
id uid text createdate
1 1 Hello I'm Tony Stark. 2018-03-09 20:00:14
2 3 Today I have went shopping at Laffayette. 2018-03-09 20:01:02
4 1 My company is hiring interns. 2018-03-12 02:30:30
CREATE TABLE "user_profiles" (`uid` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `partitionid` int(11) DEFAULT NULL, `followers` int(11) DEFAULT NULL, PRIMARY KEY (`uid`))
3 rows from user_profiles table:
uid name email partitionid followers
1 Iron Man ts@richest.com 1 6662425
2 Mary Mary@yale.edu 2 890
3 Black Widow\n bw@superhero.com 23 35425845
|
product_catalog | Find the names of all the catalog entries. | SELECT distinct(catalog_entry_name) FROM catalog_contents | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What are all the catalog entry names? | SELECT distinct(catalog_entry_name) FROM catalog_contents | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the list of attribute data types possessed by more than 3 attribute definitions. | SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING count(*) > 3 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What are the attribute data types with more than 3 attribute definitions? | SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING count(*) > 3 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What is the attribute data type of the attribute with name "Green"? | SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_name = "Green" | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the attribute data type for the attribute named "Green". | SELECT attribute_data_type FROM Attribute_Definitions WHERE attribute_name = "Green" | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the name and level of catalog structure with level between 5 and 10. | SELECT catalog_level_name , catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What are the name and level of catalog structure with level number between 5 and 10 | SELECT catalog_level_name , catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find all the catalog publishers whose name contains "Murray" | SELECT distinct(catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE "%Murray%" | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Which catalog publishers have substring "Murray" in their names? | SELECT distinct(catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE "%Murray%" | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Which catalog publisher has published the most catalogs? | SELECT catalog_publisher FROM catalogs GROUP BY catalog_publisher ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the catalog publisher that has the most catalogs. | SELECT catalog_publisher FROM catalogs GROUP BY catalog_publisher ORDER BY count(*) DESC LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the names and publication dates of all catalogs that have catalog level number greater than 5. | SELECT t1.catalog_name , t1.date_of_publication FROM catalogs AS t1 JOIN catalog_structure AS t2 ON t1.catalog_id = t2.catalog_id WHERE catalog_level_number > 5 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What are the name and publication date of the catalogs with catalog level number above 5? | SELECT t1.catalog_name , t1.date_of_publication FROM catalogs AS t1 JOIN catalog_structure AS t2 ON t1.catalog_id = t2.catalog_id WHERE catalog_level_number > 5 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What are the entry names of catalog with the attribute possessed by most entries. | SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.attribute_value = (SELECT attribute_value FROM Catalog_Contents_Additional_Attributes GROUP BY attribute_value ORDER BY count(*) DESC LIMIT 1) | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the entry names of the catalog with the attribute that have the most entries. | SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.attribute_value = (SELECT attribute_value FROM Catalog_Contents_Additional_Attributes GROUP BY attribute_value ORDER BY count(*) DESC LIMIT 1) | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What is the entry name of the most expensive catalog (in USD)? | SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the entry name of the catalog with the highest price (in USD). | SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What is the level name of the cheapest catalog (in USD)? | SELECT t2.catalog_level_name FROM catalog_contents AS t1 JOIN catalog_structure AS t2 ON t1.catalog_level_number = t2.catalog_level_number ORDER BY t1.price_in_dollars LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the level name of the catalog with the lowest price (in USD). | SELECT t2.catalog_level_name FROM catalog_contents AS t1 JOIN catalog_structure AS t2 ON t1.catalog_level_number = t2.catalog_level_number ORDER BY t1.price_in_dollars LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What are the average and minimum price (in Euro) of all products? | SELECT avg(price_in_euros) , min(price_in_euros) FROM catalog_contents | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Give me the average and minimum price (in Euro) of the products. | SELECT avg(price_in_euros) , min(price_in_euros) FROM catalog_contents | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What is the product with the highest height? Give me the catalog entry name. | SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Which catalog content has the highest height? Give me the catalog entry name. | SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the name of the product that has the smallest capacity. | SELECT catalog_entry_name FROM catalog_contents ORDER BY capacity ASC LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Which catalog content has the smallest capacity? Return the catalog entry name. | SELECT catalog_entry_name FROM catalog_contents ORDER BY capacity ASC LIMIT 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the names of all the products whose stock number starts with "2". | SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE "2%" | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Which catalog contents have a product stock number that starts from "2"? Show the catalog entry names. | SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE "2%" | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the names of catalog entries with level number 8. | SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What are the names of catalog entries with level number 8? | SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the names of the products with length smaller than 3 or height greater than 5. | SELECT catalog_entry_name FROM catalog_contents WHERE LENGTH < 3 OR width > 5 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Which catalog contents have length below 3 or above 5? Find the catalog entry names. | SELECT catalog_entry_name FROM catalog_contents WHERE LENGTH < 3 OR width > 5 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the name and attribute ID of the attribute definitions with attribute value 0. | SELECT t1.attribute_name , t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Which attribute definitions have attribute value 0? Give me the attribute name and attribute ID. | SELECT t1.attribute_name , t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the name and capacity of products with price greater than 700 (in USD). | SELECT catalog_entry_name , capacity FROM Catalog_Contents WHERE price_in_dollars > 700 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Which catalog contents has price above 700 dollars? Show their catalog entry names and capacities. | SELECT catalog_entry_name , capacity FROM Catalog_Contents WHERE price_in_dollars > 700 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the dates on which more than one revisions were made. | SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING count(*) > 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | On which days more than one revisions were made on catalogs. | SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING count(*) > 1 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | How many products are there in the records? | SELECT count(*) FROM catalog_contents | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Find the total number of catalog contents. | SELECT count(*) FROM catalog_contents | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | Name all the products with next entry ID greater than 8. | SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
product_catalog | What are the catalog entry names of the products with next entry ID above 8? | SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8 | CREATE TABLE `Attribute_Definitions` (
`attribute_id` INTEGER PRIMARY KEY,
`attribute_name` VARCHAR(30),
`attribute_data_type` VARCHAR(10)
)
3 rows from Attribute_Definitions table:
attribute_id attribute_name attribute_data_type
1 Green Bool
2 Black Bool
3 Yellow Bool
CREATE TABLE `Catalogs` (
`catalog_id` INTEGER PRIMARY KEY,
`catalog_name` VARCHAR(50),
`catalog_publisher` VARCHAR(80),
`date_of_publication` DATETIME,
`date_of_latest_revision` DATETIME
)
3 rows from Catalogs table:
catalog_id catalog_name catalog_publisher date_of_publication date_of_latest_revision
1 Chocolate Koepp-Rutherford handmade chocolate store 2013-03-15 05:09:17 2017-09-26 12:10:36
2 Coffee Bean Murray Coffee shop 2012-04-13 06:37:09 2017-10-26 01:16:51
3 Lemonade Russel-Gislason Lemon shop 2012-11-27 19:29:22 2017-12-04 06:48:13
CREATE TABLE `Catalog_Structure` (
`catalog_level_number` INTEGER PRIMARY KEY,
`catalog_id` INTEGER NOT NULL,
`catalog_level_name` VARCHAR(50),
FOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )
)
3 rows from Catalog_Structure table:
catalog_level_number catalog_id catalog_level_name
1 1 Category
8 2 Sub-Category
9 8 Product
CREATE TABLE `Catalog_Contents` (
`catalog_entry_id` INTEGER PRIMARY KEY,
`catalog_level_number` INTEGER NOT NULL,
`parent_entry_id` INTEGER,
`previous_entry_id` INTEGER,
`next_entry_id` INTEGER,
`catalog_entry_name` VARCHAR(80),
`product_stock_number` VARCHAR(50),
`price_in_dollars` DOUBLE NULL,
`price_in_euros` DOUBLE NULL,
`price_in_pounds` DOUBLE NULL,
`capacity` VARCHAR(20),
`length` VARCHAR(20),
`height` VARCHAR(20),
`width` VARCHAR(20),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents table:
catalog_entry_id catalog_level_number parent_entry_id previous_entry_id next_entry_id catalog_entry_name product_stock_number price_in_dollars price_in_euros price_in_pounds capacity length height width
1 1 5 9 7 Cola 89 cp 200.78 159.84 172.17 1 3 9 5
2 8 6 9 8 Root beer 37 hq 687.59 590.11 471.78 8 6 5 6
3 8 6 6 1 Cream Soda 52 ee 360.50 202.32 110.32 5 9 7 8
CREATE TABLE `Catalog_Contents_Additional_Attributes` (
`catalog_entry_id` INTEGER NOT NULL,
`catalog_level_number` INTEGER NOT NULL,
`attribute_id` INTEGER NOT NULL,
`attribute_value` VARCHAR(255) NOT NULL,
FOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),
FOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )
)
3 rows from Catalog_Contents_Additional_Attributes table:
catalog_entry_id catalog_level_number attribute_id attribute_value
5 8 4 1
15 9 3 0
11 1 2 0
|
flight_1 | How many aircrafts do we have? | SELECT count(*) FROM Aircraft | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | How many aircrafts exist in the database? | SELECT count(*) FROM Aircraft | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show name and distance for all aircrafts. | SELECT name , distance FROM Aircraft | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the names and distances for all airplanes? | SELECT name , distance FROM Aircraft | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show ids for all aircrafts with more than 1000 distance. | SELECT aid FROM Aircraft WHERE distance > 1000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the ids of all aircrafts that can cover a distance of more than 1000? | SELECT aid FROM Aircraft WHERE distance > 1000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | How many aircrafts have distance between 1000 and 5000? | SELECT count(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the count of aircrafts that have a distance between 1000 and 5000? | SELECT count(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the name and distance for aircraft with id 12? | SELECT name , distance FROM Aircraft WHERE aid = 12 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the name and distance for the aircraft that has an id of 12? | SELECT name , distance FROM Aircraft WHERE aid = 12 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the minimum, average, and maximum distance of all aircrafts. | SELECT min(distance) , avg(distance) , max(distance) FROM Aircraft | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Return the minimum, average and maximum distances traveled across all aircrafts. | SELECT min(distance) , avg(distance) , max(distance) FROM Aircraft | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show the id and name of the aircraft with the maximum distance. | SELECT aid , name FROM Aircraft ORDER BY distance DESC LIMIT 1 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the id and name of the aircraft that can cover the maximum distance? | SELECT aid , name FROM Aircraft ORDER BY distance DESC LIMIT 1 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show the name of aircrafts with top three lowest distances. | SELECT name FROM Aircraft ORDER BY distance LIMIT 3 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the aircrafts with top 3 shortest lengthes? List their names. | SELECT name FROM Aircraft ORDER BY distance LIMIT 3 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show names for all aircrafts with distances more than the average. | SELECT name FROM Aircraft WHERE distance > (SELECT avg(distance) FROM Aircraft) | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the names of all aircrafts that can cover more distances than average? | SELECT name FROM Aircraft WHERE distance > (SELECT avg(distance) FROM Aircraft) | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | How many employees do we have? | SELECT count(*) FROM Employee | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the number of employees? | SELECT count(*) FROM Employee | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show name and salary for all employees sorted by salary. | SELECT name , salary FROM Employee ORDER BY salary | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the name and salary of all employees in order of salary? | SELECT name , salary FROM Employee ORDER BY salary | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show ids for all employees with at least 100000 salary. | SELECT eid FROM Employee WHERE salary > 100000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the id of every employee who has at least a salary of 100000? | SELECT eid FROM Employee WHERE salary > 100000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | How many employees have salary between 100000 and 200000? | SELECT count(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the number of employees that have a salary between 100000 and 200000? | SELECT count(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the name and salary for employee with id 242518965? | SELECT name , salary FROM Employee WHERE eid = 242518965 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the name and salary of the employee with the id 242518965? | SELECT name , salary FROM Employee WHERE eid = 242518965 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is average and maximum salary of all employees. | SELECT avg(salary) , max(salary) FROM Employee | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the average and largest salary of all employees? | SELECT avg(salary) , max(salary) FROM Employee | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show the id and name of the employee with maximum salary. | SELECT eid , name FROM Employee ORDER BY salary DESC LIMIT 1 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the id and name of the employee with the highest salary? | SELECT eid , name FROM Employee ORDER BY salary DESC LIMIT 1 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show the name of employees with three lowest salaries. | SELECT name FROM Employee ORDER BY salary ASC LIMIT 3 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the name of the 3 employees who get paid the least? | SELECT name FROM Employee ORDER BY salary ASC LIMIT 3 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show names for all employees with salary more than the average. | SELECT name FROM Employee WHERE salary > (SELECT avg(salary) FROM Employee) | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the names of all employees who have a salary higher than average? | SELECT name FROM Employee WHERE salary > (SELECT avg(salary) FROM Employee) | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show the id and salary of Mark Young. | SELECT eid , salary FROM Employee WHERE name = 'Mark Young' | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the id and salary of the employee named Mark Young? | SELECT eid , salary FROM Employee WHERE name = 'Mark Young' | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | How many flights do we have? | SELECT count(*) FROM Flight | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the number of flights? | SELECT count(*) FROM Flight | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show flight number, origin, destination of all flights in the alphabetical order of the departure cities. | SELECT flno , origin , destination FROM Flight ORDER BY origin | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the flight number, origin, and destination for all flights in alphabetical order by departure cities? | SELECT flno , origin , destination FROM Flight ORDER BY origin | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show all flight number from Los Angeles. | SELECT flno FROM Flight WHERE origin = "Los Angeles" | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the numbers of all flights coming from Los Angeles? | SELECT flno FROM Flight WHERE origin = "Los Angeles" | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show origins of all flights with destination Honolulu. | SELECT origin FROM Flight WHERE destination = "Honolulu" | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the origins of all flights that are headed to Honolulu? | SELECT origin FROM Flight WHERE destination = "Honolulu" | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show me the departure date and arrival date for all flights from Los Angeles to Honolulu. | SELECT departure_date , arrival_date FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu" | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the departure and arrival dates of all flights from LA to Honolulu? | SELECT departure_date , arrival_date FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu" | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show flight number for all flights with more than 2000 distance. | SELECT flno FROM Flight WHERE distance > 2000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What are the numbers of all flights that can cover a distance of more than 2000? | SELECT flno FROM Flight WHERE distance > 2000 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the average price for flights from Los Angeles to Honolulu. | SELECT avg(price) FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu" | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the average price for flights from LA to Honolulu? | SELECT avg(price) FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu" | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show origin and destination for flights with price higher than 300. | SELECT origin , destination FROM Flight WHERE price > 300 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the origin and destination for all flights whose price is higher than 300? | SELECT origin , destination FROM Flight WHERE price > 300 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show the flight number and distance of the flight with maximum price. | SELECT flno , distance FROM Flight ORDER BY price DESC LIMIT 1 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | What is the flight number and its distance for the one with the maximum price? | SELECT flno , distance FROM Flight ORDER BY price DESC LIMIT 1 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
flight_1 | Show the flight number of flights with three lowest distances. | SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3 | CREATE TABLE flight(
flno number(4,0) primary key,
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0),
foreign key("aid") references `aircraft`("aid"))
3 rows from flight table:
flno origin destination distance departure_date arrival_date price aid
99 Los Angeles Washington D.C. 2308 04/12/2005 09:30 04/12/2005 09:40 235.98 1
13 Los Angeles Chicago 1749 04/12/2005 08:45 04/12/2005 08:45 220.98 3
346 Los Angeles Dallas 1251 04/12/2005 11:50 04/12/2005 07:05 182.00 2
CREATE TABLE aircraft(
aid number(9,0) primary key,
name varchar2(30),
distance number(6,0))
3 rows from aircraft table:
aid name distance
1 Boeing 747-400 8430
2 Boeing 737-800 3383
3 Airbus A340-300 7120
CREATE TABLE employee(
eid number(9,0) primary key,
name varchar2(30),
salary number(10,2))
3 rows from employee table:
eid name salary
242518965 James Smith 120433
141582651 Mary Johnson 178345
11564812 John Williams 153972
CREATE TABLE certificate(
eid number(9,0),
aid number(9,0),
primary key(eid,aid),
foreign key("eid") references `employee`("eid"),
foreign key("aid") references `aircraft`("aid"))
3 rows from certificate table:
eid aid
11564812 2
11564812 10
90873519 6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.