human
Schema:
Manufacturers (Code, Name, Headquarter, Founder, Revenue)
Products (Code, Name, Price, Manufacturer)
Please answer with SQL.
assistant
Sure, I understand.
human
List names of each manufacturer?
assistant
SELECT name FROM manufacturers;
human
Name of each manufacturer's product?
assistant
SELECT T1.Name , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code;
human
Price of each manufacturer's product?
assistant
SELECT T1.price FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code;
human
Which product is the most expensive?
assistant
SELECT name FROM products ORDER by price desc LIMIT 1;
human
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
What of their least expensive product?
assistant
SELECT T1.Name , MIN( T1.Price ) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name ;