human
Schema:
Manufacturers (Code, Name, Headquarter, Founder, Revenue)
Products (Code, Name, Price, Manufacturer)
Please answer with SQL.
assistant
Sure, I understand.
human
Select the name and price of all products with a price larger than or equal to $180, and sort first by price (in descending order), and then by name (in ascending order).
assistant
SELECT name , price FROM products WHERE price >= 180 ORDER BY price DESC , name ASC
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
Compute the number of products with a price larger than or equal to $180.
assistant
SELECT count(*) FROM products WHERE price >= 180
human
Select the name and price of the cheapest product.
assistant
SELECT name , price FROM Products ORDER BY price ASC LIMIT 1
human
Select the names of manufacturer whose products have an average price higher than or equal to $150.
assistant
SELECT avg(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name HAVING avg(T1.price) >= 150
human
What are the names of products with price at most 200?
assistant
SELECT name FROM products WHERE price <= 200 ;