human
Schema:
Manufacturers (Code, Name, Headquarter, Founder, Revenue)
Products (Code, Name, Price, Manufacturer)
Please answer with SQL.
assistant
Sure, I understand.
human
Select the average price of each manufacturer's products, showing only the manufacturer's code.
assistant
SELECT AVG(Price) , Manufacturer FROM Products GROUP BY Manufacturer
human
Select the name of the products with a price less than or equal to $200.
assistant
SELECT name FROM products WHERE price <= 200
human
Select the names and the prices of all the products in the store.
assistant
SELECT name , price FROM products
human
Select the name of each manufacturer along with the name and price of its most expensive product.
assistant
SELECT T1.Name , max(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name
human
Select the name and price of the cheapest product.
assistant
SELECT name , price FROM Products ORDER BY price ASC LIMIT 1
human
What are the codes and names of the cheapest products in each category?
assistant
SELECT code , name , MIN( price ) FROM products GROUP BY name ;