A structured and practical SQL learning and practice repository designed for beginners, students, self-learners, developers, data analysts, and anyone preparing for SQL interviews.
This repository takes you from SQL fundamentals to advanced concepts, with explanations, examples, practice problems, solutions, challenges, interview questions, and real-world projects.
The goal of this repository is to provide a complete, hands-on SQL learning path that helps you:
This repository primarily uses:
MySQL 8.0+
Examples and exercises are written using MySQL-compatible SQL syntax.
Some SQL features differ between MySQL, PostgreSQL, SQL Server, and other database systems. When relevant, those differences will be mentioned in the notes.
The repository is organized into progressive modules.
| Module | Topic |
|---|---|
| 01 | SQL Basics |
| 02 | Databases & Tables |
| 03 | INSERT, UPDATE & DELETE |
| 04 | SELECT |
| 05 | WHERE |
| 06 | ORDER BY |
| 07 | DISTINCT & LIMIT |
| 08 | Aggregate Functions |
| 09 | GROUP BY |
| 10 | HAVING |
| Module | Topic |
|---|---|
| 11 | JOINs |
| 12 | Subqueries |
| 13 | Set Operations |
| 14 | String Functions |
| 15 | Date & Time Functions |
| 16 | CASE Expressions |
| 17 | NULL Handling |
| 18 | Constraints |
| 19 | Primary & Foreign Keys |
| 20 | Views |
| Module | Topic |
|---|---|
| 21 | Indexes |
| 22 | Common Table Expressions (CTEs) |
| 23 | Window Functions |
| 24 | Stored Procedures |
| 25 | Triggers |
| 26 | Transactions |
| 27 | Database Normalization |
| Module | Topic |
|---|---|
| 28 | SQL Interview Questions |
| Module | Project |
|---|---|
| 29 | SQL Projects |
sql-practice/
โ
โโโ README.md
โโโ LICENSE
โโโ CONTRIBUTING.md
โโโ CODE_OF_CONDUCT.md
โโโ .gitignore
โ
โโโ 01_sql_basics/
โโโ 02_databases_and_tables/
โโโ 03_insert_update_delete/
โโโ 04_select/
โโโ 05_where/
โโโ 06_order_by/
โโโ 07_limit_distinct/
โโโ 08_aggregate_functions/
โโโ 09_group_by/
โโโ 10_having/
โ
โโโ 11_joins/
โโโ 12_subqueries/
โโโ 13_set_operations/
โโโ 14_string_functions/
โโโ 15_date_functions/
โโโ 16_case/
โโโ 17_null_handling/
โโโ 18_constraints/
โโโ 19_keys/
โโโ 20_views/
โ
โโโ 21_indexes/
โโโ 22_ctes/
โโโ 23_window_functions/
โโโ 24_stored_procedures/
โโโ 25_triggers/
โโโ 26_transactions/
โโโ 27_normalization/
โ
โโโ 28_interview_questions/
โ
โโโ 29_projects/
Most learning modules follow the same structure:
01_sql_basics/
โ
โโโ notes.md
โโโ examples.sql
โโโ practice.sql
โโโ solutions.sql
โโโ challenge.sql
notes.mdContains explanations of the topic, syntax, important concepts, and common mistakes.
examples.sqlContains commented SQL examples demonstrating the concepts.
practice.sqlContains exercises for practicing the topic.
solutions.sqlContains solutions to the practice exercises.
Try solving the questions yourself before looking at the solutions.
challenge.sqlContains more challenging problems designed to improve SQL problem-solving skills.
Exercises are organized by difficulty.
Focuses on understanding basic syntax and individual concepts.
Combines multiple SQL concepts and requires more reasoning.
Requires advanced query logic and problem-solving.
Interview-style or real-world problems designed to test your understanding.
The repository will use realistic datasets throughout the learning process.
Example tables may include:
students
courses
employees
departments
customers
orders
products
Using consistent datasets makes it easier to practice increasingly advanced SQL concepts without constantly learning a new database structure.
Track your progress as you work through the repository.
By completing this repository, you will practice:
git clone https://github.com/your-username/sql-practice.git
cd sql-practice
Install MySQL 8.0 or later on your computer.
You can use MySQL through:
Navigate to any module:
01_sql_basics/
Read the notes, study the examples, solve the practice problems, and then check your answers against the solutions.
For the best results, follow this cycle:
Learn
โ
Read the Notes
โ
Study the Examples
โ
Write Queries Yourself
โ
Solve Practice Problems
โ
Check Solutions
โ
Attempt the Challenge
โ
Build Projects
Avoid simply copying the solutions.
The goal is to develop the ability to think in SQL and solve problems independently.
The repository will gradually include SQL interview questions covering:
The interview section will focus on both conceptual questions and practical query-writing problems.
The project section will apply the concepts learned throughout the repository to realistic scenarios.
Planned projects include:
Practice:
Practice:
Practice:
Practice:
Practice:
This repository aims to provide:
Contributions are welcome!
If you find an error, have a useful SQL exercise, or want to improve the learning material, please read the Contributing Guidelines.
Please read the Code of Conduct before contributing to this repository.
This project is licensed under the MIT License.
See the LICENSE file for more information.
If you find this repository useful for learning SQL or preparing for interviews, consider giving it a โญ on GitHub.
Your support helps the project grow and encourages the creation of more learning resources.
Shreya Pathak
GitHub: @shreyaapaathakk
Learn SQL. Practice consistently. Solve real problems. Build projects.