Skip to content

About

SQL from scratch.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL From Scratch

This repository is a structured learning path to master SQL using Python notebooks and DuckDB. The goal is to go from beginner to advanced level through progressive exercises and realistic datasets.

Objective

The purpose of this project is to develop strong SQL skills commonly used in data analytics and data science roles. By the end of this learning path, you should be able to:

  • Write efficient SQL queries on single and multiple tables
  • Perform data aggregation and transformation
  • Work with joins and relational data models
  • Use advanced SQL features such as CTEs and window functions
  • Solve real-world data analysis problems

Tech Stack

  • Python
  • DuckDB
  • Pandas
  • Jupyter Notebooks

Project Structure

The repository is organized into progressive modules:

00_setup/ Introduction to DuckDB and environment setup

01_basics/ Basic SQL queries (SELECT, WHERE, ORDER BY, LIMIT)

02_aggregations/ GROUP BY, aggregation functions, HAVING

03_joins/ INNER JOIN, LEFT JOIN, relational data queries

04_advanced_sql/ CASE WHEN, CTEs, subqueries

05_window_functions/ ROW_NUMBER, RANK, LAG, LEAD

06_case_studies/ Realistic business analysis projects

datasets/ Data generation scripts and data documentation

utils/ Helper functions for DuckDB and notebooks

Getting Started

1. Install dependencies

pip install -r requirements.txt

2. Launch Jupyter Notebook

jupyter notebook

3. Follow the learning path

Start with 00_setup and proceed in order. Each notebook builds on the previous one.

Datasets

All datasets are generated using Python scripts located in the datasets/ folder. These datasets simulate real-world scenarios such as:

  • E-commerce transactions
  • Customer behavior
  • Product catalogs
  • Energy consumption data

The goal is to practice SQL on realistic and structured data.

Learning Approach

Each notebook follows a consistent structure:

  • Short theoretical introduction
  • Dataset loading using Python and DuckDB
  • Progressive SQL exercises
  • Step-by-step explanations of solutions

Recommended Progression

  1. Basic SQL queries
  2. Aggregations and grouping
  3. Joins and relational data
  4. Advanced SQL concepts
  5. Window functions
  6. Case studies and applied analysis

Final Goal

By completing this repository, you should be able to independently analyze datasets using SQL and approach data problems with a structured analytical mindset similar to a data analyst or data scientist.

Author

Personal project designed for learning SQL from scratch through practical exercises and real-world inspired datasets.

About

SQL from scratch.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages