TGViewer
SQL Programming Resources SQL Programming Resources @sqlanalyst ยท 76.7K subscribers
Post #2101 3.56K
๐Ÿ”น Top 10 SQL Functions/Commands Commonly Used in Data Analysis ๐Ÿ“Š

1๏ธโƒฃ SELECT
โ€“ Used to retrieve specific columns from a table.
SELECT name, age FROM users;

2๏ธโƒฃ WHERE
โ€“ Filters rows based on a condition.
SELECT ร— FROM sales WHERE region = 'North';

3๏ธโƒฃ GROUP BY
โ€“ Groups rows that have the same values into summary rows.
SELECT region, SUM(sales) FROM sales GROUP BY region;

4๏ธโƒฃ ORDER BY
โ€“ Sorts the result by one or more columns.
SELECT * FROM customers ORDER BY created_at DESC;

5๏ธโƒฃ JOIN
โ€“ Combines rows from two or more tables based on a related column.
SELECT a.name, b.salary
FROM employees a
JOIN salaries b ON a.id = b.emp_id;

6๏ธโƒฃ COUNT() / SUM() / AVG() / MIN() / MAX()
โ€“ Common aggregate functions for metrics and summaries.
SELECT COUNT(ร—) FROM orders WHERE status = 'completed';

7๏ธโƒฃ HAVING
โ€“ Filters after a GROUP BY (unlike WHERE, which filters before).
SELECT department, COUNT() FROM employees GROUP BY department HAVING COUNT() > 10;

8๏ธโƒฃ LIMIT
โ€“ Restricts number of rows returned.
SELECT * FROM products LIMIT 5;

9๏ธโƒฃ CASE
โ€“ Implements conditional logic in queries.
SELECT name,
CASE
WHEN score >= 90 THEN 'A'
WHEN score >= 75 THEN 'B'
ELSE 'C'
END AS grade
FROM students;

๐Ÿ”Ÿ DATE functions (NOW(), DATE_PART(), DATEDIFF(), etc.)
โ€“ Handle and extract info from dates.
SELECT DATE_PART('year', order_date) FROM orders;

๐Ÿ’ฌ Tap โค๏ธ for more!
  • โค 5
  • ๐Ÿ‘ 1
More from @sqlanalyst
  1. Oct 16, 2026๐——๐—ฎ๐˜๐—ฎ ๐˜€๐—ฐ๐—ถ๐—ฒ๐—ป๐—ฐ๐—ฒ ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ช๐—ถ๐˜๐—ต ๐—”๐—œ๐Ÿ˜ Future Ready Data Scienโ€ฆ
  2. Oct 16, 2026SQL Interview Series โ€” Part 11 ๐Ÿ“Œ Question 11: Calculate a Running Total of Sales Supposeโ€ฆ
  3. Oct 13, 2026SQL Interview Series โ€” Part 8 ๐Ÿ“Œ Question 8: Find Customers Who Have Never Placed an Orderโ€ฆ
  4. Oct 13, 2026๐—ง๐—ข๐—ฃ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ข๐—จ๐—ฅ๐—ฆ๐—˜๐—ฆ ๐—ง๐—ข ๐—•๐—ข๐—ข๐—ฆ๐—ง ๐—ฌ๐—ข๐—จ๐—ฅ ๐—ฆ๐—ž๐—œ๐—Ÿ๐—Ÿ๐—ฆ ๐—œ๐—ก ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ! Explorโ€ฆ
  5. Oct 12, 2026SQL Interview Series โ€” Part 6 ๐Ÿ“Œ Question 6: Find the Top 2 Highest-Paid Employees in Eachโ€ฆ
  6. Oct 12, 2026๐Ÿš€ ๐—ช๐—ต๐—ถ๐—ฐ๐—ต ๐—ง๐—ฒ๐—ฐ๐—ต ๐—ฆ๐—ธ๐—ถ๐—น๐—น ๐—ช๐—ถ๐—น๐—น ๐—ฌ๐—ผ๐˜‚ ๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ? Want to builโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’