Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.
Roadmap · Web DevelopmentFree

Sefism SQL and Databases Roadmap

A nine-stage roadmap for using a relational database properly on PostgreSQL, MySQL or SQL Server: single-table queries, joins, aggregation and window functions, schema design, transactions and locking, indexes and query plans, SQL from application code, and a short comparison with MongoDB. It suits students and early-career engineers, and ends with the ability to design a sound schema, read a query plan and prove a speed-up with numbers.

Stages

9

Sefism · Oct 2026

Topics

67 per edition

Sefism · Oct 2026

Estimated hours

114

Sefism · Oct 2026

Weeks at 5 hours a week

26

Sefism · Oct 2026

Project ideas

4

Sefism · Oct 2026

Database editions

3 (PostgreSQL, MySQL, SQL Server)

Sefism · Oct 2026

Format

Roadmap

Topic

Web Development

Provider

Sefism

Time needed

About 114 hours, 14 to 26 weeks

Level

Beginner

Access

Free

What this roadmap is

SQL and databases is Sefism's nine-stage roadmap for using a relational database properly, on PostgreSQL, MySQL or SQL Server. It goes from your first SELECT to schema design, transactions, indexes and query plans, and using SQL safely from application code, then closes with a short look at NoSQL through MongoDB.

By the end you should be able to:

  • write correct queries with joins, GROUP BY, subqueries, CTEs and window functions against a real sample database, and explain why each returns the rows it does
  • design a normalised schema with keys, constraints and sensible data types, and know when a denormalised copy is worth it
  • change data inside transactions without lost updates, and explain isolation levels and locking in plain words
  • read an execution plan, add the right index and prove the speed-up with before and after numbers
  • call the database from code with parameterised queries, migrations and a connection pool, and restore a backup you took yourself

Who it suits, and who should start elsewhere

It suits students taking a databases course, early-career engineers who use an ORM but freeze at raw SQL, and anyone moving towards backend, data analytics or data engineering work.

You should already be comfortable writing small programs; if not, start with Programming foundations. If your stack is document-based, the dedicated MongoDB roadmap goes much further than the last stage here. If you want the theory side of databases alongside operating systems and networks, see CS core subjects.

Editions, prerequisites and time

You choose the database: PostgreSQL (the default, because it follows the SQL standard closely and has excellent documentation), MySQL or SQL Server. Setup, GUI tools, dialect details, keyset pagination and recommended documentation follow your choice; the concepts are the same.

The estimate is about 114 hours across 9 stages:

  • A student with 10 to 12 hours a week finishes in roughly 14 weeks, about one semester. Try two evening sessions writing queries against the sample database, and a longer weekend session on the stage milestone.
  • Someone working full time with about 5 hours a week should plan for around 26 weeks. Short sessions suit SQL well: 45 minutes of practice problems on weekday evenings, plus one longer session for design and performance work.

Stage by stage

1. Relational thinking and your setup (8 hours)

Tables, rows and columns, primary and foreign keys, the families of SQL statements, installing your database locally, a GUI (pgAdmin, MySQL Workbench, or SSMS or VS Code), the command-line client, loading a sample database and your first tables by hand. Milestone: a local database with GUI and command-line client connected, a sample database loaded, and a saved script that creates two related tables. Every .sql file goes into Git from day one.

2. Querying one table (12 hours)

SELECT, aliases and DISTINCT, filtering with WHERE, NULL and three-valued logic, ORDER BY, limiting rows in your dialect, CASE, text and date functions, and the logical order a query runs in. Milestone: 30 working single-table queries, each commented with the question it answers. The habit the stage builds: guess how many rows a query will return before you run it.

3. Joins and set operations (12 hours)

Inner joins, left, right and full outer joins, self and cross joins, join grain and row multiplication, UNION and UNION ALL, INTERSECT and EXCEPT, and finding rows without a match. Milestone: 20 join and set queries including an outer join that shows zeros, a self join and one anti-join, with a note on the grain of each report. When a total looks too big, suspect the join before the data.

4. Aggregation, subqueries and window functions (18 hours)

The longest stage: aggregates and GROUP BY, HAVING, conditional aggregation, subqueries and EXISTS, CTEs, optional recursive CTEs, window functions with running totals, LAG and LEAD, and ranking and top N per group. Milestone: a small analytics report with monthly totals and month-over-month change, top 3 per category, a pivot and a multi-step CTE.

5. Schema design (14 hours)

Modelling entities and relationships, one-to-many and many-to-many, keys and generated ids, data types for your database, normalisation to third normal form, when to denormalise, constraints and views. Milestone: a schema for a real scenario such as a clinic or course registration, with an ER diagram, a CREATE script, seed data and a note on your normalisation decisions.

6. Changing data safely (14 hours)

INSERT and getting the new id back, UPDATE and DELETE without accidents, upserts, transactions, ACID and isolation levels, lost updates and other anomalies, row locks and deadlocks, and what happens to child rows on delete. Milestone: reproduce a lost update in two sessions, then fix it twice, once with an atomic UPDATE and once with a row lock.

7. Indexes and query plans (14 hours)

How B-tree indexes work and what they cost, reading EXPLAIN and execution plans, full scans versus index lookups, composite indexes and column order, index-friendly queries, covering and clustered indexes, statistics, and keyset pagination. Milestone: a performance write-up on a table of at least a million generated rows: three slow queries with plans and timings before and after, and one index you decided not to add.

8. SQL in real applications (14 hours)

SQL injection and parameterised queries, ORMs and the N+1 problem, schema migrations, connection pools, users, roles and least privilege, and backups with restore drills. Milestone: a small API or script with parameterised queries, migrations in Git, a pool and a least-privilege user, plus a backup you have restored.

9. NoSQL and MongoDB (8 hours)

Where NoSQL fits, documents and collections, SQL queries mapped to MongoDB, embedding versus referencing, indexes and transactions in MongoDB, and JSON inside your relational database. Milestone: model one feature both ways, run the same three queries in each, and write half a page on which you would choose and why.

Projects that fit

How it works on Sefism

Everything on Sefism is free to learn from. The public page at SQL and databases shows the full stage list for your chosen database, with the first two stages open: their topics, milestones and recommended material. Later stages show their title, summary, hours and topic count.

To open every stage, add the roadmap to your dashboard. Adding a roadmap uses credits, new members get starting credits when they join, and your first roadmap is free. Once it is on your dashboard you can:

If you are new, create a free account first. Credits are there so the platform goes to people who are actually learning, and if you run out while learning seriously, you can ask for more.

Every topic includes a short check question and an AI tutor prompt you can paste into an assistant to be quizzed.

The companion cheat sheet

The SQL and databases cheat sheet mirrors the nine stages in the same three database editions, with syntax for your dialect and the classic mistake for each concept. Keep it open while you work through the stage milestones.

Related on Sefism

What you can do afterwards

Answer real questions with SQL, design a schema that protects its own data, change data safely under concurrency, and prove a performance fix with a plan and numbers. Those are the database skills every backend and data role leans on.

Frequently asked questions

How long does it take to learn SQL? The roadmap estimates about 114 hours: roughly 14 weeks at 10 to 12 hours a week, or 26 at 5. Querying alone (stages 2 to 4) is about 42 of those hours.

Should I learn PostgreSQL, MySQL or SQL Server? PostgreSQL is the default for its closeness to the standard and its documentation. Pick MySQL or SQL Server if your course, job or target employers use them. The concepts carry over.

Is SQL still worth learning in 2026? Yes. Relational databases sit at the core of most systems, and the roadmap's own advice on NoSQL is that most real systems use a relational database as the core and add a document store or cache only where it clearly helps.

Do I need to learn MongoDB too? Stage 9 gives you enough to compare the two models. Go further with the MongoDB roadmap only if your stack uses it.

sqldatabasebackendbeginner friendly

Ready to start?

Opens on Sefism in a new tab.

Open the roadmap
Link broken or out of date?

Report a problem

With "Sefism SQL and Databases Roadmap". Only Tauseef reads this.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.