Shanraq.org Shanraq.org

SQL: a family budget without guesswork

13 practical lessons from a first table to an auditable report and verified backup, on computers, tablets, and phones.

Lessons: 4 · 29 min to read · 260 min to practise

Every lesson is open: reading needs no account.

Start with lesson one →

  1. Why learn SQL: a family budget you can question

    In the first lesson, we open a ready-made family-budget database and calculate income, spending, and savings with one query. SQL is useful when an answer must be exact, repeatable, and auditable rather than assembled by hand.

    5 min to read · 20 min to practise

  2. Tables, rows, columns, and NULL: model the budget first

    We identify the project's accounts, categories, transactions, and limits, and separate a missing value from zero. Before learning syntax, understand the single fact represented by each row.

    2 min to read · 20 min to practise

  3. CREATE TABLE: a schema that rejects impossible data

    Create the family-budget tables and move essential validation into the database.

    2 min to read · 20 min to practise

  4. INSERT and parameters: add spending safely

    Insert one or several transactions and keep user values separate from SQL code.

    2 min to read · 20 min to practise

  5. SELECT: find the needed rows without changing them

    Learn projection, filtering, stable sorting, and limiting a result.

    2 min to read · 20 min to practise

  6. CASE, COALESCE, and dates: turn stored facts into a useful view

    Compute display columns, handle NULL honestly, and define month boundaries.

    2 min to read · 20 min to practise

  7. SUM, COUNT, GROUP BY, and HAVING: totals by category

    Compress transactions into auditable totals and detect limits that were exceeded.

    2 min to read · 20 min to practise

  8. Keys and JOIN: connect transactions, accounts, and categories

    Normalise the budget model and join tables by stable keys without multiplying rows.

    2 min to read · 20 min to practise

  9. Subqueries and WITH: answer a complex question in steps

    Break the savings-rate calculation into named, testable CTE stages.

    2 min to read · 20 min to practise

  10. Window functions: a running balance without losing rows

    Calculate the balance after every event and rank spending while keeping each source row.

    2 min to read · 20 min to practise

  11. Transactions and UPDATE: change everything or nothing

    Make safe corrections and treat a transfer as one atomic database operation.

    2 min to read · 20 min to practise

  12. Data reconciliation: find a gap before making a decision

    Use control totals, duplicate candidates, and relationship checks to test completeness.

    2 min to read · 20 min to practise

  13. Indexes, EXPLAIN, and the final report

    Assemble the report, inspect its plan, add a justified index, and prove a backup by restoring it.

    2 min to read · 20 min to practise