Join Our Community
Database Roadmap

SQL Roadmap 2026: Learn SQL Step by Step

SQL is asked in almost every developer, tester and data analyst interview. This roadmap takes you from your first SELECT query to joins, window functions and query optimisation using MySQL – in about 6–8 weeks.

6–8 WeeksAt 1–2 hrs/day
10 StagesBasics to advanced
BeginnerNo coding needed
MySQLDatabase used

By Deepak Panwar, Founder – Smart Programming  |  Updated: October 2026

Who is this roadmap for?

  • Students preparing for placements
  • Java, Python and web developers
  • Software testers and QA engineers
  • Aspiring data analysts

What you will be able to do

  • Write queries with joins, grouping and subqueries
  • Design normalised database tables
  • Answer common SQL interview questions
  • Use SQL inside Java / Python projects

How to follow this roadmap

  • Install MySQL and practise every query
  • Create your own sample tables
  • Solve 5–10 queries daily
  • Explain each query in plain English

The 10-Stage Roadmap

Follow the stages in order. Finish the practice task before moving to the next stop.

Stage 1 · Day 1–3

Database Basics & Setup

Understand what a database is and get MySQL running on your system.

  • What is a DBMS / RDBMS
  • Tables, rows & columns
  • Install MySQL & Workbench
  • Data types

Practice: Create a database called college with a students table.

Stage 2 · Day 4–7

DDL & DML Commands

Create tables and add, change or remove data.

  • CREATE, ALTER, DROP, TRUNCATE
  • INSERT, UPDATE, DELETE
  • Constraints – PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK

Practice: Create 4 related tables (students, courses, enrollments, teachers) with keys.

Stage 3 · Week 2

SELECT Queries

Read exactly the data you need.

  • SELECT & aliases
  • WHERE, AND, OR, IN, BETWEEN, LIKE
  • ORDER BY & LIMIT
  • DISTINCT
  • NULL handling

Practice: Write 25 SELECT queries on your college database.

Stage 4 · Week 3

Functions, GROUP BY & HAVING

Summarise data – a favourite of interviewers.

  • COUNT, SUM, AVG, MIN, MAX
  • GROUP BY
  • HAVING vs WHERE
  • String & date functions
  • CASE WHEN

Practice: Find the number of students per course and courses with more than 10 students.

Milestone: you can answer basic SQL interview questions
Stage 5 · Week 4

Joins

Combine data from multiple tables – the most important SQL topic.

  • INNER JOIN
  • LEFT & RIGHT JOIN
  • FULL OUTER JOIN (via UNION)
  • SELF JOIN
  • CROSS JOIN

Practice: List every student with their courses and teachers using joins.

Stage 6 · Week 5

Subqueries & CTEs

Break complex questions into smaller queries.

  • Single-row & multi-row subqueries
  • Correlated subqueries
  • EXISTS
  • WITH (CTE)

Practice: Solve “second highest salary” in 3 different ways.

Stage 7 · Week 5–6

Normalization & Design

Design tables that avoid duplicate and inconsistent data.

  • 1NF, 2NF, 3NF
  • ER diagrams
  • One-to-many & many-to-many
  • Keys & relationships

Practice: Normalise a messy single-table design into 3NF.

Stage 8 · Week 6

Indexes & Performance

Make queries fast on large tables.

  • Indexes & when to use them
  • Composite indexes
  • EXPLAIN
  • Query optimisation tips

Practice: Use EXPLAIN to compare a query before and after adding an index.

Stage 9 · Week 7

Views, Procedures, Triggers & Transactions

Database features used in real applications.

  • Views
  • Stored procedures
  • Triggers
  • Transactions – COMMIT & ROLLBACK
  • ACID properties

Practice: Write a stored procedure that transfers money between two accounts inside a transaction.

Stage 10 · Week 8

Window Functions & Interview Practice

Advanced queries that impress interviewers.

  • ROW_NUMBER, RANK, DENSE_RANK
  • PARTITION BY
  • LEAD & LAG
  • Running totals

Practice: Practise 50 common SQL interview queries (Nth salary, duplicates, top N per group).

You are confident with SQL for interviews and real projects
Advertisements

Projects to Build

Beginner

College Database

Students, courses and enrollments with reports using joins and GROUP BY.

Intermediate

Library Management

Books, members and issue records with views and stored procedures.

Advanced

Sales Dashboard Queries

Monthly revenue, top products and running totals using window functions.

Tips to Succeed

  1. Always practise on real tables – reading queries is not the same as writing them.
  2. Learn JOINs deeply – most SQL interview questions are join questions.
  3. Know WHERE vs HAVING and DELETE vs TRUNCATE vs DROP – asked very often.
  4. Think in sets, not loops – SQL works on whole groups of rows at once.
  5. Connect SQL to code – use it with JDBC or JPA in your Java projects.

Frequently Asked Questions

How long does it take to learn SQL?

Basic SQL can be learned in 2–3 weeks. Following this complete roadmap, including joins, subqueries and window functions, takes about 6–8 weeks.

Which database should I learn first?

MySQL is a great first choice – it is free, widely used in Indian companies and works perfectly with Java and PHP projects.

Is SQL required for Java developers?

Yes. Almost every Java application uses a database, and SQL questions are common in Java developer interviews.

Is SQL enough to get a job?

SQL alone is enough for some data and support roles, but combined with Java, Python or testing skills it greatly improves your chances.

Advertisements

Practise SQL with Smart Programming

Use SQL in real projects with JDBC and Spring Data JPA in our Java courses, and test your knowledge with free MCQs.

Explore Other Roadmaps

Hello Coder, how can I help you ?