Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Revision & Practice

  • Abhimanyu Saklani

A structured SQL learning repository covering SQL fundamentals, advanced SQL concepts, database design, and practical projects.

The goal of this repository is to build a strong foundation in SQL and progressively move toward advanced querying and real-world database problem solving.


Learning Roadmap

Day Topics Status
Day 1 SQL Basics, DDL, DML, SELECT, Filtering, Sorting, Aggregations, GROUP BY, HAVING, Joins Cpmpleted
Day 2 Window Functions, Views, Indexes Completed
Day 3 CTEs, Subqueries Completed
Day 4 Database Normalization & Database Design Completed
Day 5 SQL Project Upcoming

📂 Repository Structure

SQL/
│
├── README.md
│
├── day-1/
│   ├── SQL_Basics.sql
│   └── README.md
│
├── day-2/
│   ├── Winodow_Function_Index.sql
│   └── README.md
│
├── day-3/
│   ├── SQL_CTE_Subqueries.sql
│   └── README.md
│
├── day-4/
│   ├── normalization.sql
│   └── README.md
│
└── day-5/
    ├── project.sql
    └── README.md

Each day contains:

  • SQL file → Queries, examples, and practice
  • README.md → Concepts, syntax, explanations, and important notes

Day 1 — SQL Basics

Topics Covered

  • Introduction to SQL

  • Database fundamentals

  • Tables, rows, columns

  • DDL — Data Definition Language

    • CREATE
    • ALTER
    • DROP
    • TRUNCATE
  • DML — Data Manipulation Language

    • INSERT
    • UPDATE
    • DELETE
  • DQL

    • SELECT
  • Filtering

    • WHERE
    • AND
    • OR
    • BETWEEN
    • IS NULL
    • IS NOT NULL
    • LIKE
  • Sorting

    • ORDER BY
  • DISTINCT

  • LIMIT

  • Aggregate Functions

    • COUNT()
    • SUM()
    • AVG()
    • MIN()
    • MAX()
  • GROUP BY

  • HAVING

  • Joins

    • INNER JOIN
    • LEFT JOIN
    • RIGHT JOIN
    • FULL OUTER JOIN
    • CROSS JOIN
    • SELF JOIN
  • Primary Keys

  • Foreign Keys

  • Constraints


Day 2 — Advanced SQL

Topics

  • Window Functions

    • ROW_NUMBER()
    • RANK()
    • DENSE_RANK()
    • LAG()
    • LEAD()
    • FIRST_VALUE()
    • LAST_VALUE()
    • PARTITION BY
    • ORDER BY inside windows
  • Views

    • Creating views
    • Updating/removing views
    • Use cases
  • Indexes

    • What is an index?
    • Creating indexes
    • Benefits and drawbacks
    • When to use indexes

Day 3 — Querying Techniques

Topics

  • Subqueries

    • Scalar subqueries
    • Single-row subqueries
    • Multi-row subqueries
    • Correlated subqueries
    • IN
    • EXISTS
  • Common Table Expressions (CTEs)

    • WITH
    • Multiple CTEs
    • Recursive CTEs
  • CTE vs Subquery

  • Practical query optimization


Day 4 — Database Design

Topics

  • Database Design

  • Data Redundancy

  • Data Anomalies

    • Insert anomaly
    • Update anomaly
    • Delete anomaly
  • Normalization

    • 1NF — First Normal Form
    • 2NF — Second Normal Form
    • 3NF — Third Normal Form
    • BCNF
  • Primary Keys

  • Candidate Keys

  • Composite Keys

  • Foreign Keys

  • Relationships

    • One-to-One
    • One-to-Many
    • Many-to-Many
  • Entity Relationship concepts


Day 5 — SQL Project

The final stage will combine the concepts learned throughout the previous days into a practical SQL project.

Project will include

  • Database design
  • Multiple related tables
  • Primary & foreign keys
  • Constraints
  • Data insertion
  • Data cleaning
  • Joins
  • Aggregate functions
  • GROUP BY
  • HAVING
  • Subqueries
  • CTEs
  • Window functions
  • Views
  • Indexes
  • Business-oriented SQL queries
  • Analysis and insights

Learning Goals

By completing this repository, I aim to be able to:

  • Write SQL queries confidently
  • Design relational databases
  • Work with multiple related tables
  • Perform data aggregation and analysis
  • Write complex queries using CTEs and subqueries
  • Use window functions for analytical problems
  • Understand database normalization
  • Understand indexes and query performance
  • Solve SQL interview problems
  • Apply SQL to real-world datasets and projects

Database

The examples and practice queries in this repository primarily use:

PostgreSQL

Some syntax may differ between PostgreSQL, MySQL, SQL Server, and Oracle.


Progress

Day 1  ████████████  SQL Fundamentals
Day 2  ████████████  Window Functions / Views / Indexes
Day 3  ████████████  CTEs / Subqueries
Day 4  ████████████  Normalization / Database Design
Day 5  ░░░░░░░░░░░░  Project

Approach

This repository follows a learn → write → practice → apply approach.

Each topic is documented with:

  1. Concept
  2. Syntax
  3. Example
  4. Practice queries
  5. Real-world use cases

The final project will bring the concepts together into one practical database and analysis workflow.


🚀 Future Additions

Potential topics to add later:

  • Transactions
  • ACID Properties
  • Stored Procedures
  • Functions
  • Triggers
  • Query Optimization
  • EXPLAIN / EXPLAIN ANALYZE
  • Database Transactions
  • Advanced PostgreSQL features
  • SQL Interview Questions
  • LeetCode / HackerRank SQL Practice

Progress Tracking

  • Repository setup
  • Day 1 — SQL Basics
  • Day 2 — Window Functions, Views & Indexes
  • Day 3 — CTEs & Subqueries
  • Day 4 — Normalization & Database Design
  • Day 5 — SQL Project
  • Final review & interview practice

About

SQL revision notes and practice covering PostgreSQL fundamentals, advanced SQL, database design, and practical projects.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors