Skip to main content
Albero Academy
All tutorials

SQL tutorials

Queries, joins, subqueries, window functions and database design for analytics work.

Chapters
16
Total reading
3h 50m
Level
Beginner to Advanced

Chapters

  1. Chapter 1

    SQL Intro — SELECT, WHERE, ORDER BY

    Get started with SQL — the SELECT statement, filtering with WHERE, sorting with ORDER BY, and the basics of relational thinking.
    14 min readStart
  2. Chapter 2

    SQL Joins — INNER, LEFT, RIGHT, FULL

    Understand the four classical joins, the difference between INNER and LEFT, common pitfalls, and how to find missing matches.
    15 min readStart
  3. Chapter 3

    SQL Window Functions

    Master OVER, PARTITION BY, ROW_NUMBER, RANK, LAG and running totals — the most-asked topic in modern analytics interviews.
    17 min readStart
  4. Chapter 4

    SQL Subqueries & CTEs

    Master subqueries and Common Table Expressions (WITH) — when to use which, recursive CTEs, and writing readable analytical SQL.
    16 min readStart
  5. Chapter 5

    SQL Aggregations Deep Dive

    COUNT vs COUNT DISTINCT, conditional aggregation, GROUPING SETS, ROLLUP, CUBE, and the patterns that show up in real analytics work.
    14 min readStart
  6. Chapter 6

    Filtering in Depth

    Master the WHERE clause — comparison and logical operators, LIKE patterns, IN, BETWEEN, and the crucial rules for handling NULL.
    15 min readStart
  7. Chapter 7

    Sorting, Limiting & Pagination

    Order results precisely, remove duplicates with DISTINCT, and page through large result sets with LIMIT and OFFSET.
    13 min readStart
  8. Chapter 8

    CASE & Conditional Logic

    Add if/then logic to queries with CASE, handle NULLs with COALESCE and NULLIF, and pivot data with conditional aggregation.
    14 min readStart
  9. Chapter 9

    Data Types & NULL

    Choose the right column type, convert between types with CAST, and understand NULL's three-valued logic properly.
    13 min readStart
  10. Chapter 10

    String & Text Functions

    Clean and transform text in queries — concatenation, case, trimming, substrings, replacement, and search.
    13 min readStart
  11. Chapter 11

    Date & Time Functions

    Work with dates — the current time, extracting parts, date arithmetic, truncation for grouping, and formatting.
    14 min readStart
  12. Chapter 12

    Set Operations

    Combine the results of two queries — UNION, UNION ALL, INTERSECT and EXCEPT — and when to reach for each versus a JOIN.
    13 min readStart
  13. Chapter 13

    INSERT, UPDATE & DELETE

    Change data safely — insert rows, update and delete with a WHERE, upsert on conflict, and the habits that prevent disasters.
    14 min readStart
  14. Chapter 14

    Table Design & Constraints

    Model data well — CREATE TABLE, primary and foreign keys, constraints that guard integrity, and a practical look at normalization.
    15 min readStart
  15. Chapter 15

    Indexes & Query Performance

    Make queries fast — how indexes work, which columns to index, reading the query plan with EXPLAIN, and common performance pitfalls.
    15 min readStart
  16. Chapter 16

    Views, Transactions & Best Practices

    Save queries as views, guarantee all-or-nothing changes with transactions, and finish with the habits of professional SQL.
    15 min readStart