db_id
stringclasses 127
values | query
stringlengths 20
523
| question
stringlengths 16
224
| schema
stringclasses 127
values |
---|---|---|---|
products_gen_characteristics
|
SELECT count(*) FROM CHARACTERISTICS
|
How many characteristics are there?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM CHARACTERISTICS
|
Count the number of characteristics.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_name , typical_buying_price FROM products
|
What are the names and buying prices of all the products?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_name , typical_buying_price FROM products
|
Return the names and typical buying prices for all products.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT color_description FROM ref_colors
|
List the description of all the colors.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT color_description FROM ref_colors
|
What are the descriptions for each color?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT DISTINCT characteristic_name FROM CHARACTERISTICS
|
Find the names of all the product characteristics.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT DISTINCT characteristic_name FROM CHARACTERISTICS
|
What are the different names of the product characteristics?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_name FROM products WHERE product_category_code = "Spices"
|
What are the names of products with category "Spices"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_name FROM products WHERE product_category_code = "Spices"
|
Return the names of products in the category 'Spices'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT T1.product_name , T2.color_description , T1.product_description FROM products AS T1 JOIN Ref_colors AS T2 ON T1.color_code = T2.color_code WHERE product_category_code = "Herbs"
|
List the names, color descriptions and product descriptions of products with category "Herbs".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT T1.product_name , T2.color_description , T1.product_description FROM products AS T1 JOIN Ref_colors AS T2 ON T1.color_code = T2.color_code WHERE product_category_code = "Herbs"
|
What are the names, color descriptions, and product descriptions for products in the 'Herbs' category?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products WHERE product_category_code = "Seeds"
|
How many products are there under the category "Seeds"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products WHERE product_category_code = "Seeds"
|
Count the number of products in the category 'Seeds'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products WHERE product_category_code = "Spices" AND typical_buying_price > 1000
|
Find the number of products with category "Spices" and typically sold above 1000.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products WHERE product_category_code = "Spices" AND typical_buying_price > 1000
|
How many products are in the 'Spices' category and have a typical price of over 1000?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_category_code , typical_buying_price FROM products WHERE product_name = "cumin"
|
What is the category and typical buying price of the product with name "cumin"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_category_code , typical_buying_price FROM products WHERE product_name = "cumin"
|
Return the category code and typical price of 'cumin'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_category_code FROM products WHERE product_name = "flax"
|
Which category does the product named "flax" belong to?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_category_code FROM products WHERE product_name = "flax"
|
What is the code of the category that the product with the name 'flax' belongs to?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT T1.product_name FROM products AS T1 JOIN ref_colors AS T2 ON T1.color_code = T2.color_code WHERE T2.color_description = 'yellow'
|
What is the name of the product with the color description 'yellow'?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT T1.product_name FROM products AS T1 JOIN ref_colors AS T2 ON T1.color_code = T2.color_code WHERE T2.color_description = 'yellow'
|
Give the name of the products that have a color description 'yellow'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT T1.product_category_description FROM ref_product_categories AS T1 JOIN products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%'
|
Find the category descriptions of the products whose descriptions include letter 't'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT T1.product_category_description FROM ref_product_categories AS T1 JOIN products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%'
|
What are the descriptions of the categories that products with product descriptions that contain the letter t are in?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "catnip"
|
What is the color description of the product with name "catnip"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "catnip"
|
Give the color description for the product 'catnip'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.color_code , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "chervil"
|
What is the color code and description of the product named "chervil"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.color_code , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "chervil"
|
Return the color code and description for the product with the name 'chervil'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.product_id , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code JOIN product_characteristics AS t3 ON t1.product_id = t3.product_id GROUP BY t1.product_id HAVING count(*) >= 2
|
Find the id and color description of the products with at least 2 characteristics.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.product_id , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code JOIN product_characteristics AS t3 ON t1.product_id = t3.product_id GROUP BY t1.product_id HAVING count(*) >= 2
|
What are the product ids and color descriptions for products with two or more characteristics?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.product_name FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "white"
|
List all the product names with the color description "white".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.product_name FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "white"
|
What are the names of products with 'white' as their color description?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.product_name , t1.typical_buying_price , t1.typical_selling_price FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "yellow"
|
What are the name and typical buying and selling prices of the products that have color described as "yellow"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.product_name , t1.typical_buying_price , t1.typical_selling_price FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "yellow"
|
Return the names and typical buying and selling prices for products that have 'yellow' as their color description.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id WHERE t1.product_name = "sesame"
|
How many characteristics does the product named "sesame" have?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id WHERE t1.product_name = "sesame"
|
Count the number of characteristics the product 'sesame' has.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(DISTINCT t3.characteristic_name) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
|
How many distinct characteristic names does the product "cumin" have?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(DISTINCT t3.characteristic_name) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
|
Count the number of different characteristic names the product 'cumin' has.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
|
What are all the characteristic names of product "sesame"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
|
Return the characteristic names of the 'sesame' product.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name , t3.characteristic_data_type FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "cumin"
|
List all the characteristic names and data types of product "cumin".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name , t3.characteristic_data_type FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "cumin"
|
What are the names and data types of the characteristics of the 'cumin' product?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame" AND t3.characteristic_type_code = "Grade"
|
List all characteristics of product named "sesame" with type code "Grade".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame" AND t3.characteristic_type_code = "Grade"
|
What are the names of the characteristics of the product 'sesame' that have the characteristic type code 'Grade'?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "laurel"
|
How many characteristics does the product named "laurel" have?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "laurel"
|
Count the number of characteristics of the product named 'laurel'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "flax"
|
Find the number of characteristics that the product "flax" has.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "flax"
|
Count the number of characteristics of the 'flax' product.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "fast"
|
Find the name of the products that have the color description "red" and have the characteristic name "fast".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "fast"
|
What are the names of the products that have a color description of 'red' and the 'fast' characteristic?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "hot"
|
How many products have the characteristic named "hot"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "hot"
|
Count the number of products with the 'hot' charactersitic.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT DISTINCT t1.product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "warm"
|
List the all the distinct names of the products with the characteristic name 'warm'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT DISTINCT t1.product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "warm"
|
What are the different product names for products that have the 'warm' characteristic:?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "slow"
|
Find the number of the products that have their color described as "red" and have a characteristic named "slow".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "slow"
|
How many products have the color description 'red' and the characteristic name 'slow'?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "white" OR t3.characteristic_name = "hot"
|
Count the products that have the color description "white" or have the characteristic name "hot".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "white" OR t3.characteristic_name = "hot"
|
How many products have their color described as 'white' or have a characteristic with the name 'hot'?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
|
What is the unit of measuerment of the product category code "Herbs"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
|
Return the unit of measure for 'Herb' products.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
|
Find the product category description of the product category with code "Spices".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
|
What is the description of the product category with the code 'Spices'?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_category_description , unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
|
What is the product category description and unit of measurement of category "Herbs"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT product_category_description , unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
|
Return the description and unit of measurement for products in the 'Herbs' category.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.unit_of_measure FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "cumin"
|
What is the unit of measurement of product named "cumin"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.unit_of_measure FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "cumin"
|
Give the unit of measure for the product with the name 'cumin'.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.unit_of_measure , t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "chervil"
|
Find the unit of measurement and product category code of product named "chervil".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.unit_of_measure , t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "chervil"
|
What are the unit of measure and category code for the 'chervil' product?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.product_name FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code JOIN ref_colors AS t3 ON t1.color_code = t3.color_code WHERE t3.color_description = "white" AND t2.unit_of_measure != "Handful"
|
Find the product names that are colored 'white' but do not have unit of measurement "Handful".
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t1.product_name FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code JOIN ref_colors AS t3 ON t1.color_code = t3.color_code WHERE t3.color_description = "white" AND t2.unit_of_measure != "Handful"
|
What are the names of products that are not 'white' in color and are not measured by the unit 'Handful'?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY count(*) DESC LIMIT 1
|
What is the description of the color for most products?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY count(*) DESC LIMIT 1
|
Return the color description that is most common across all products.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY count(*) ASC LIMIT 1
|
What is the description of the color used by least products?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY count(*) ASC LIMIT 1
|
Give the color description that is least common across products.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name ORDER BY count(*) DESC LIMIT 1
|
What is the characteristic name used by most number of the products?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name ORDER BY count(*) DESC LIMIT 1
|
Return the name of the characteristic that is most common across all products.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT characteristic_name , other_characteristic_details , characteristic_data_type FROM CHARACTERISTICS EXCEPT SELECT t1.characteristic_name , t1.other_characteristic_details , t1.characteristic_data_type FROM CHARACTERISTICS AS t1 JOIN product_characteristics AS t2 ON t1.characteristic_id = t2.characteristic_id
|
What are the names, details and data types of the characteristics which are never used by any product?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT characteristic_name , other_characteristic_details , characteristic_data_type FROM CHARACTERISTICS EXCEPT SELECT t1.characteristic_name , t1.other_characteristic_details , t1.characteristic_data_type FROM CHARACTERISTICS AS t1 JOIN product_characteristics AS t2 ON t1.characteristic_id = t2.characteristic_id
|
Give the names, details, and data types of characteristics that are not found in any product.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name HAVING count(*) >= 2
|
What are characteristic names used at least twice across all products?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name HAVING count(*) >= 2
|
Give the names of characteristics that are in two or more products?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM Ref_colors WHERE color_code NOT IN ( SELECT color_code FROM products )
|
How many colors are never used by any product?
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
products_gen_characteristics
|
SELECT count(*) FROM Ref_colors WHERE color_code NOT IN ( SELECT color_code FROM products )
|
Count the number of colors that are not used in any products.
|
PRAGMA foreign_keys = ON;
CREATE TABLE `Ref_Characteristic_Types` (
`characteristic_type_code` VARCHAR(15) PRIMARY KEY,
`characteristic_type_description` VARCHAR(80)
);
CREATE TABLE `Ref_Colors` (
`color_code` VARCHAR(15) PRIMARY KEY,
`color_description` VARCHAR(80)
);
CREATE TABLE `Ref_Product_Categories` (
`product_category_code` VARCHAR(15) PRIMARY KEY,
`product_category_description` VARCHAR(80),
`unit_of_measure` VARCHAR(20)
);
CREATE TABLE `Characteristics` (
`characteristic_id` INTEGER PRIMARY KEY,
`characteristic_type_code` VARCHAR(15) NOT NULL,
`characteristic_data_type` VARCHAR(10),
`characteristic_name` VARCHAR(80),
`other_characteristic_details` VARCHAR(255),
FOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )
);
CREATE TABLE `Products` (
`product_id` INTEGER PRIMARY KEY,
`color_code` VARCHAR(15) NOT NULL,
`product_category_code` VARCHAR(15) NOT NULL,
`product_name` VARCHAR(80),
`typical_buying_price` VARCHAR(20),
`typical_selling_price` VARCHAR(20),
`product_description` VARCHAR(255),
`other_product_details` VARCHAR(255),
FOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )
);
CREATE TABLE `Product_Characteristics` (
`product_id` INTEGER NOT NULL,
`characteristic_id` INTEGER NOT NULL,
`product_characteristic_value` VARCHAR(50),
FOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),
FOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )
);
INSERT INTO Ref_Characteristic_Types (`characteristic_type_code`, `characteristic_type_description`) VALUES ('Grade', 'Grade')INSERT INTO Ref_Colors (`color_code`, `color_description`) VALUES ('9', 'red')INSERT INTO Ref_Product_Categories (`product_category_code`, `product_category_description`, `unit_of_measure`) VALUES ('Herbs', 'Herbs', 'Handful ')INSERT INTO Characteristics (`characteristic_id`, `characteristic_type_code`, `characteristic_data_type`, `characteristic_name`, `other_characteristic_details`) VALUES (1, 'Grade', 'numquam', 'slow', NULL)INSERT INTO Products (`product_id`, `color_code`, `product_category_code`, `product_name`, `typical_buying_price`, `typical_selling_price`, `product_description`, `other_product_details`) VALUES (1, '4', 'Spices', 'cumin', '', '2878.3', 'et', NULL)INSERT INTO Product_Characteristics (`product_id`, `characteristic_id`, `product_characteristic_value`) VALUES (13, 13, 'low')
|
swimming
|
SELECT count(*) FROM event
|
How many events are there?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT name FROM event ORDER BY YEAR DESC
|
List all the event names by year from the most recent to the oldest.
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT name FROM event ORDER BY YEAR DESC LIMIT 1
|
What is the name of the event that happened in the most recent year?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT count(*) FROM stadium
|
How many stadiums are there?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT name FROM stadium ORDER BY capacity DESC LIMIT 1
|
Find the name of the stadium that has the maximum capacity.
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT name FROM stadium WHERE capacity < (SELECT avg(capacity) FROM stadium)
|
Find the names of stadiums whose capacity is smaller than the average capacity.
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT country FROM stadium GROUP BY country ORDER BY count(*) DESC LIMIT 1
|
Find the country that has the most stadiums.
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT country FROM stadium GROUP BY country HAVING count(*) <= 3
|
Which country has at most 3 stadiums listed?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000
|
Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT count(DISTINCT city) FROM stadium WHERE opening_year < 2006
|
How many cities have a stadium that was opened before the year of 2006?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT country , count(*) FROM stadium GROUP BY country
|
How many stadiums does each country have?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year > 2006
|
Which countries do not have a stadium that was opened after 2006?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT count(*) FROM stadium WHERE country != 'Russia'
|
How many stadiums are not in country "Russia"?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT name FROM swimmer ORDER BY meter_100
|
Find the names of all swimmers, sorted by their 100 meter scores in ascending order.
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT count(DISTINCT nationality) FROM swimmer
|
How many different countries are all the swimmers from?
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT nationality , count(*) FROM swimmer GROUP BY nationality HAVING count(*) > 1
|
List countries that have more than one swimmer.
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT meter_200 , meter_300 FROM swimmer WHERE nationality = 'Australia'
|
Find all 200 meter and 300 meter results of swimmers with nationality "Australia".
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
swimming
|
SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win'
|
Find the names of swimmers who has a result of "win".
|
PRAGMA foreign_keys = ON;
CREATE TABLE "swimmer" (
"ID" int,
"name" text,
"Nationality" text,
"meter_100" real,
"meter_200" text,
"meter_300" text,
"meter_400" text,
"meter_500" text,
"meter_600" text,
"meter_700" text,
"Time" text,
PRIMARY KEY ("ID")
);
CREATE TABLE "stadium" (
"ID" int,
"name" text,
"Capacity" int,
"City" text,
"Country" text,
"Opening_year" int,
PRIMARY KEY ("ID")
);
CREATE TABLE "event" (
"ID" int,
"Name" text,
"Stadium_ID" int,
"Year" text,
PRIMARY KEY ("ID"),
FOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)
);
CREATE TABLE "record" (
"ID" int,
"Result" text,
"Swimmer_ID" int,
"Event_ID" int,
PRIMARY KEY ("Swimmer_ID","Event_ID"),
FOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),
FOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)
);
INSERT INTO "swimmer" VALUES ("7","Przemysław Stańczyk","Poland","57.31","1:57.10","2:56.02","3:55.36","4:54.21","5:52.59","6:50.91","7:47.91");
INSERT INTO "stadium" VALUES (1,"Nou Mestalla","75000","Valencia","Spain","2004");
INSERT INTO "event" VALUES (1,"FINA",1,"2016");
INSERT INTO "record" VALUES (1,"NC",1,1);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.