1๏ธโฃ SELECT โ Pick the columns you want
SELECT name, age FROM students;
2๏ธโฃ WHERE โ Filter rows based on condition
SELECT * FROM orders WHERE status = 'delivered';
3๏ธโฃ ORDER BY โ Sort the results
SELECT * FROM products ORDER BY price DESC;
4๏ธโฃ GROUP BY โ Group rows for aggregation
SELECT department, COUNT(*) FROM employees GROUP BY department;
5๏ธโฃ HAVING โ Filter groups after aggregation
SELECT department, COUNT(*) FROM employees
GROUP BY department HAVING COUNT(*) > 5;
6๏ธโฃ LIMIT / TOP โ Restrict number of rows
-- MySQL/PostgreSQL
SELECT * FROM sales LIMIT 10;
-- SQL Server
SELECT TOP 10 * FROM sales;
7๏ธโฃ DISTINCT โ Remove duplicates
SELECT DISTINCT city FROM customers;
8๏ธโฃ BETWEEN โ Filter within a range
SELECT * FROM invoices WHERE amount BETWEEN 100 AND 500;
9๏ธโฃ IN โ Match any from a list
SELECT * FROM users WHERE role IN ('admin', 'manager');
๐ ALIAS (AS) โ Rename columns or tables
SELECT name AS EmployeeName FROM employees;
๐ก Tip: Combine clauses for powerful queries!
โฅ๏ธ Double Tap if you found this helpful!