SQL

Database Query Language

·View all resources →

SQL Learning Roadmap

SQL (Structured Query Language) is the universal language for interacting with relational databases. PostgreSQL, MySQL, SQLite, BigQuery, Snowflake — they all use SQL. It's required for backend development, data analysis, data science, and data engineering. SQL is one of the most leverage skills you can learn.

Total time

6–10 weeks

Stages

5 stages

Job-ready at

Stage 3

Career paths

3 paths

1
2
3
4
5

Before you start — Prerequisites

✓

Basic computer literacy

SQL is beginner-friendly — no prior programming experience required to start.

✓

Optional: any programming language

Knowing a language like Python helps you use SQL in applications, but pure SQL is learnable standalone.

1

Stage 1: SQL Foundations

Read data from a database

1–2 weeks

Topics to cover

What a relational database isSELECT columns FROM tableWHERE: filtering rows with conditionsComparison operators: =, !=, <, >, BETWEEN, INAND, OR, NOT logical operatorsORDER BY and LIMITNULL: IS NULL and IS NOT NULLLIKE for pattern matchingDISTINCT to remove duplicatesAliases: AS for columns and tables

Bold = especially important

Milestone

You can query any database table, filter by any condition, and sort and limit results — the foundation for all SQL work.

Project to build

Explore a real dataset

Download the Northwind or Chinook sample database, answer 10 business questions using SELECT + WHERE + ORDER BY — no joins yet.

2

Stage 2: Aggregations & Grouping

Summarize data, not just retrieve it

1–2 weeks

Topics to cover

COUNT(), SUM(), AVG(), MIN(), MAX()GROUP BY: aggregate by categoryHAVING: filter aggregated groupsROUND() and other scalar functionsString functions: UPPER, LOWER, CONCAT, SUBSTRINGDate functions: NOW(), DATE_PART(), EXTRACT()CASE WHEN for conditional logicCOALESCE for NULL handlingCAST for type conversionSubqueries in SELECT

Bold = especially important

Milestone

You write queries that summarize millions of rows into meaningful business metrics — totals, averages, counts by category, trends over time.

Project to build

Sales analysis report

Using the Northwind DB: total revenue by country, top 5 customers by spend, monthly sales trend, average order value by category.

3

Stage 3: Joins & Relationships

✓ Min. Job Ready

Combine data from multiple tables

2–3 weeks

Topics to cover

Primary keys and foreign keysINNER JOIN: rows matching in both tablesLEFT JOIN: all rows from left + matchesRIGHT JOIN and FULL OUTER JOINCROSS JOIN: Cartesian productSelf joins: a table joined to itselfJoining more than two tablesSubqueries in WHERE and FROMEXISTS and NOT EXISTSUNION and UNION ALL

Bold = especially important

Milestone

You confidently join any set of tables and can answer questions that require combining data from 3–4 tables.

Project to build

Multi-table customer report

Query customers, orders, order_details, and products to produce a report: top customers, their most purchased categories, last order date.

4

Stage 4: Writing Data & Schema Design

Create, update, delete, and model data

2–3 weeks

Topics to cover

INSERT INTO: add new rowsUPDATE: modify existing rowsDELETE: remove rows (with caution)CREATE TABLE: columns, types, constraintsData types: INTEGER, TEXT, NUMERIC, BOOLEAN, TIMESTAMPNOT NULL, UNIQUE, DEFAULT, CHECK constraintsALTER TABLE: add columns, change typesDatabase normalization: 1NF, 2NF, 3NFTransactions: BEGIN, COMMIT, ROLLBACKRETURNING clause (PostgreSQL)

Bold = especially important

Milestone

You design a normalized database schema, create it with DDL, and write safe INSERT/UPDATE/DELETE queries with transactions.

Project to build

Schema design for an e-commerce store

Design tables for users, products, orders, order_items — proper FK constraints, normalization, seed data with INSERT.

5

Stage 5: Advanced SQL

Window functions, CTEs, and optimization

2–3 weeks

Topics to cover

CTEs: WITH ... AS (readable complex queries)Recursive CTEs for hierarchiesWindow functions: ROW_NUMBER, RANK, DENSE_RANKWindow functions: LAG, LEAD, FIRST_VALUE, LAST_VALUEPARTITION BY and ORDER BY in window functionsEXPLAIN ANALYZE: understand query plansIndexes: B-tree, partial, compositeAvoiding N+1 queriesVACUUM and ANALYZE (PostgreSQL)Materialized views

Bold = especially important

Milestone

You write advanced analytical queries using CTEs and window functions, and you can profile and optimize slow queries.

Project to build

Analytics dashboard queries

Rank customers by lifetime value using window functions, rolling 30-day revenue with LAG, year-over-year comparison — explain plan optimized.

Frequently asked questions

Should I learn PostgreSQL, MySQL, or SQLite?

Start with SQLite for learning (no server to install). Then use PostgreSQL for everything else — it's the most feature-rich open-source database, has excellent documentation, and is the default choice for new projects. MySQL is common in legacy systems and some web stacks (WordPress). The SQL syntax differences are minor.

Is SQL a programming language?

SQL is a query language, not a general-purpose programming language. It's declarative — you describe what data you want, not how to get it. Most databases also have procedural extensions (PL/pgSQL in PostgreSQL), but standard SQL queries are what you learn first.

How long does SQL take to learn?

Basic SELECT, WHERE, JOIN, and GROUP BY — 2 weeks. Enough SQL to pass a data analyst interview — 6–8 weeks. Advanced SQL (window functions, CTEs, query optimization) — 3–6 months of regular practice. SQL rewards practice with real datasets more than any tutorial.

Do I need to know SQL to be a backend developer?

Yes — virtually every backend application stores data in a database. Even if you use an ORM (like Prisma, SQLAlchemy, or ActiveRecord), understanding SQL helps you debug slow queries, understand what the ORM is doing, and write raw queries when the ORM can't express what you need.

What is the difference between SQL and NoSQL?

SQL databases are relational — data in tables with rows and columns, enforced schemas, joins, and ACID transactions. NoSQL databases (MongoDB, DynamoDB, Cassandra) store documents, key-values, or graphs — flexible schemas, designed for specific access patterns. SQL is still the default choice for most applications.

Ready to start learning?

Browse our curated SQL resources — every course, book, and video ranked by quality.

View SQL Resources →