Database: product_catalog

Question: Find the list of attribute data types possessed by more than 3 attribute definitions.
SQL: SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING count(*)  >  3

Question: Find all the catalog publishers whose name contains "Murray"
SQL: SELECT distinct(catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE "%Murray%"

Question: Which catalog publisher has published the most catalogs?
SQL: SELECT catalog_publisher FROM catalogs GROUP BY catalog_publisher ORDER BY count(*) DESC LIMIT 1

Question: Find the names and publication dates of all catalogs that have catalog level number greater than 5.
SQL: SELECT t1.catalog_name ,  t1.date_of_publication FROM catalogs AS t1 JOIN catalog_structure AS t2 ON t1.catalog_id  =  t2.catalog_id WHERE catalog_level_number  >  5

Question: What are the entry names of catalog with the attribute possessed by most entries.
SQL: SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id  =  t2.catalog_entry_id WHERE t2.attribute_value  =  (SELECT attribute_value FROM Catalog_Contents_Additional_Attributes GROUP BY attribute_value ORDER BY count(*) DESC LIMIT 1)

Question: What is the entry name of the most expensive catalog (in USD)?
SQL: SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1

Question: What is the level name of the cheapest catalog (in USD)?
SQL: SELECT t2.catalog_level_name FROM catalog_contents AS t1 JOIN catalog_structure AS t2 ON t1.catalog_level_number  =  t2.catalog_level_number ORDER BY t1.price_in_dollars LIMIT 1

Question: What are the average and minimum price (in Euro) of all products?
SQL: SELECT avg(price_in_euros) ,  min(price_in_euros) FROM catalog_contents

Question: What is the product with the highest height? Give me the catalog entry name.
SQL: SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1

Question: Find the name of the product that has the smallest capacity.
SQL: SELECT catalog_entry_name FROM catalog_contents ORDER BY capacity ASC LIMIT 1

Question: Find the names of all the products whose stock number starts with "2".
SQL: SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE "2%"

Question: Find the names of catalog entries with level number 8.
SQL: SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id  =  t2.catalog_entry_id WHERE t2.catalog_level_number  =  "8"

Question: Find the names of the products with length smaller than 3 or height greater than 5.
SQL: SELECT catalog_entry_name FROM catalog_contents WHERE LENGTH  <  3 OR width  >  5

Question: Find the name and attribute ID of the attribute definitions with attribute value 0.
SQL: SELECT t1.attribute_name ,  t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id  =  t2.attribute_id WHERE t2.attribute_value  =  0