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!