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 of all products.
assistant
SELECT name FROM products;
human
which one is the most expensive?
assistant
SELECT name FROM products ORDER BY price DESC LIMIT 1;
human
also show its price.
assistant
SELECT name , price FROM products ORDER BY price DESC LIMIT 1;
human
how about the products with a price larger than or equal to 180?
assistant
SELECT name , price FROM products WHERE price >= 180;
human
sort the result by price (in descending order).
assistant
SELECT name , price FROM products WHERE price >= 180 ORDER BY price DESC;
human
then order by name (in ascending order).
assistant
SELECT name , price FROM products WHERE price >= 180 ORDER BY price DESC , name ASC ;