Expensive Electronics
Easysql
Write a query returning id, name, price for every product in the 'Electronics' category priced above 50000, ordered by id. (This case may legitimately return zero rows if no product matches.)
sqlCREATE TABLE products ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, category TEXT NOT NULL, price INTEGER NOT NULL, stock INTEGER );
Sample data:
sqlINSERT INTO products (id, name, category, price, stock) VALUES (1, 'ProLaptop', 'Electronics', 85000, 12), (2, 'Notebook', 'Stationery', 40, NULL), (3, 'Python Basics', 'Books', 350, 5), (4, 'ProPhone', 'Electronics', 45000, 0), (5, 'Novel', 'Books', 220, NULL), (6, 'Desk Lamp', 'Home', 900, 8);
Example 1
Input
(none)
Output
id name price 1 ProLaptop 85000
Combine an equality check with a comparison using AND. Reference: SELECT id, name, price FROM products WHERE category = 'Electronics' AND price > 50000 ORDER BY id;