human
Schema:
Addresses (Address_ID, address_details)
Locations (Location_ID, Other_Details)
Products (Product_ID, Product_Type_Code, Product_Name, Product_Price)
Parties (Party_ID, Party_Details)
Assets (Asset_ID, Other_Details)
Channels (Channel_ID, Other_Details)
Finances (Finance_ID, Other_Details)
Events (Event_ID, Address_ID, Channel_ID, Event_Type_Code, Finance_ID, Location_ID)
Products_in_Events (Product_in_Event_ID, Event_ID, Product_ID)
Parties_in_Events (Party_ID, Event_ID, Role_Code)
Agreements (Document_ID, Event_ID)
Assets_in_Events (Asset_ID, Event_ID)
Please answer with SQL.
assistant
Sure, I understand.
human
Show the product type codes that have both products with price higher than 4500 and products with price lower than 3000.
assistant
SELECT Product_Type_Code FROM Products WHERE Product_Price > 4500 INTERSECT SELECT Product_Type_Code FROM Products WHERE Product_Price < 3000
human
Show the prices of the products named 'Dining' or 'Trading Policy'.
assistant
SELECT Product_Price FROM Products WHERE Product_Name = 'Dining' OR Product_Name = 'Trading Policy'
human
List the name of products in ascending order of price.
assistant
SELECT Product_Name FROM Products ORDER BY Product_Price ASC
human
How many products are there?
assistant
SELECT count(*) FROM Products
human
What is the name of the product with the highest price?
assistant
SELECT Product_Name FROM Products ORDER BY Product_Price DESC LIMIT 1
human
What is the average price for products?
assistant
SELECT avg ( Product_Price ) FROM Products ;