Skip to content
Guest
← All References
SQL SQLite / PostgreSQL / MySQL

SQL Quick Reference

Essential SQL clauses for querying, filtering, aggregating, joining, and safely updating relational tables.

SELECT cols FROM t1 JOIN t2 ON ... WHERE ... GROUP BY ... ORDER BY ... LIMIT n;

Querying & Filtering

ClausePurposeExample
SELECT / DISTINCTChoose columns / deduplicate valuesSELECT DISTINCT track FROM courses;
WHEREFilter rows before groupingWHERE lessons >= 10 AND level = 'Beginner'
LIKEPattern matching (% = any chars)WHERE title LIKE '%CSS%'
ORDER BY / LIMITSort results and cap row countORDER BY score DESC LIMIT 5

Aggregation, Joins & Writes

ClausePurposeExample
COUNT / SUM / AVGSummarize numeric or row countsSELECT track, ROUND(AVG(score), 1) FROM ...
GROUP BY / HAVINGGroup rows and filter groupsGROUP BY track HAVING COUNT(*) >= 2
INNER JOIN / LEFT JOINCombine related tables by keyLEFT JOIN certs c ON c.learner_id = l.id
INSERT / UPDATE / DELETEAdd, edit, or remove rows safelyUPDATE tasks SET done = 1 WHERE id = 2;

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind