Skip to content

Morobang/sql-training

Repository files navigation

πŸŽ“ SQL Training: Fundamentals to Advanced

A complete, project-based SQL learning path for absolute beginners to advanced database professionals

SQL Server License: MIT PRs Welcome


πŸ“– About This Course

This comprehensive SQL training program takes you from absolute beginner to advanced database professional. Learn SQL using Microsoft SQL Server through hands-on exercises, real-world projects, and industry best practices.

🎯 What You'll Learn

  • Fundamentals: Database concepts, SQL syntax, basic queries
  • Data Manipulation: INSERT, UPDATE, DELETE, and transaction management
  • Advanced Queries: Joins, subqueries, set operations, CTEs
  • Performance: Indexing, query optimization, execution plans
  • Database Design: Normalization, constraints, relationships
  • Advanced Features: Views, stored procedures, triggers, analytics
  • Real-World Skills: Projects simulating actual business scenarios

⚑ New: Executable SQL Scripts!

Learn by doing! Every lesson now includes practical .sql files you can run on your own SQL Server:

  • πŸ”§ Setup Scripts: One-click database setup
  • πŸ“ Example Scripts: Working code for every concept
  • 🎯 Exercise Scripts: Hands-on practice with solutions
  • βœ… Run & Learn: Execute on your system, see real results

πŸ‘‰ See HOW-TO-USE-SCRIPTS.md to get started!

πŸ‘₯ Who This Course Is For

  • βœ… Complete Beginners - No prior SQL or database experience needed
  • βœ… Developers - Add SQL skills to your programming toolkit
  • βœ… Data Analysts - Master data querying and analysis
  • βœ… Database Administrators - Learn administration and optimization
  • βœ… Students - Build a strong foundation for career advancement

πŸ—‚οΈ Course Structure

Set up your complete SQL learning environment

Time: 1-2 hours | Difficulty: Beginner


01 - Lessons - New 3-Level Progressive Learning Path

🟒 BEGINNER LEVEL

Duration: ~1 hour 44 minutes | 5 Lessons

Master the fundamentals of SQL and database operations.

# Lesson Duration What You'll Learn
1 Intro to SQL 15 min What SQL is, why databases matter, RDBMS concepts
2 Setup Environment 12 min SQL Server setup, tools (SSMS/Azure Data Studio)
3 Query Data 58 min SELECT, WHERE, ORDER BY, basic filtering
4 DDL Commands 11 min CREATE, ALTER, DROP tables and databases
5 DML Commands 24 min INSERT, UPDATE, DELETE, basic transactions

After completing: You'll be able to create databases, tables, and perform CRUD operations.


Duration: ~10 hours | 14 Lessons

Advanced querying, functions, and analytical techniques.

# Lesson Duration What You'll Learn
1 Filtering Data 40 min Advanced WHERE, BETWEEN, IN, LIKE, NULL handling
2 SQL Joins - Basics 40 min INNER JOIN, table aliases, multi-table joins
3 SQL Joins - Advanced 35 min LEFT/RIGHT/FULL/CROSS, SELF JOIN, APPLY
4 Set Operators 45 min UNION, INTERSECT, EXCEPT
5 String Functions 26 min UPPER, LOWER, TRIM, SUBSTRING, CONCAT
6 Numeric Functions 4 min ROUND, CEILING, FLOOR, ABS, POWER
7 Date & Time Functions 96 min GETDATE, DATEADD, DATEDIFF, formatting
8 NULL Functions 32 min COALESCE, ISNULL, NULLIF, three-valued logic
9 CASE Expressions 38 min Searched/Simple CASE, conditional logic
10 Aggregate Functions 75 min COUNT, SUM, AVG, GROUP BY, HAVING
11 Window Functions - Basics 57 min OVER(), PARTITION BY, running totals
12 Window Functions - Aggregates 52 min Window frames, moving averages, ROWS vs RANGE
13 Window Functions - Ranking 68 min ROW_NUMBER, RANK, DENSE_RANK, NTILE
14 Window Functions - Value 74 min LAG, LEAD, FIRST_VALUE, LAST_VALUE

After completing: You'll master complex queries, analytics, and data transformations.


Duration: ~10 hours | 12 Lessons

Professional database development, optimization, and administration.

# Lesson Duration What You'll Learn
1 Subqueries 45 min Scalar, row, table subqueries; EXISTS, correlated
2 CTEs 52 min Common Table Expressions, recursive CTEs
3 Views 38 min Creating views, indexed views, security
4 Stored Procedures 65 min Parameters, error handling, business logic
5 Functions (UDFs) 42 min Scalar, inline, multi-statement functions
6 Triggers 48 min DML/DDL triggers, audit logging
7 Indexes & Performance 72 min Clustered/non-clustered indexes, design strategies
8 Execution Plans 58 min Reading plans, query tuning
9 Transactions Deep Dive 55 min ACID, isolation levels, deadlock prevention
10 Query Optimization 68 min Performance tuning, hints, statistics
11 Partitioning & Sharding 50 min Table partitioning, scalability patterns
12 Advanced Analytics 47 min Modern SQL, BI integration, big data

After completing: You'll be ready for production database development and DBA roles.


The original sequential 18-chapter structure is preserved in the archive folder for reference. See CONTENT-MIGRATION-MAP.md for how content was reorganized into the new 3-level structure.



Practice problems for each chapter with solutions

  • πŸ“ Chapter-by-chapter exercises (18 chapters)
  • πŸ’‘ Difficulty levels: Easy, Medium, Hard
  • βœ… Solutions provided with explanations
  • 🎯 Progressive difficulty building on previous concepts

Time: 20-30 hours | Skill Development: Essential


Supporting materials and resources


Real-world projects to solidify your skills

Project 1: Library Management System

Design and implement a complete library database with book tracking, member management, and lending functionality.

Skills: Database design, CRUD operations, relationships, basic queries
Time: 6-8 hours | Difficulty: Beginner-Intermediate

Project 2: E-Commerce Analysis

Analyze sales data, customer behavior, and product performance for an online store using advanced queries and analytics.

Skills: Complex joins, aggregations, window functions, reporting
Time: 8-10 hours | Difficulty: Intermediate-Advanced

Project 3: Employee Database

Build an HR database with organizational hierarchy, payroll calculations, and employee analytics.

Skills: Self-joins, recursive queries, calculated fields, views
Time: 8-10 hours | Difficulty: Intermediate

Project 4: Sales Reporting System

Create a comprehensive sales reporting system with dashboards, KPIs, and time-based analysis.

Skills: Complex aggregations, pivoting, stored procedures, optimization
Time: 10-12 hours | Difficulty: Advanced

Total Project Time: 32-40 hours


πŸš€ Getting Started

Prerequisites

  • Computer: Windows, Mac, or Linux
  • RAM: Minimum 4GB (8GB recommended)
  • Disk Space: 10GB for SQL Server and sample databases
  • Time Commitment: 2-5 hours per week recommended

Quick Start (30 minutes)

  1. Install SQL Server

    # Download from: https://www.microsoft.com/sql-server/sql-server-downloads
    # Choose Developer or Express edition (free)
  2. Install a SQL Client

  3. Set Up Sample Databases

    -- Follow instructions in 00-getting-started/02-database-setup.md
    CREATE DATABASE Sakila;
  4. Test Your Setup

    SELECT @@VERSION;
    SELECT * FROM sys.databases;
  5. Start Learning


πŸ“š Learning Path

🌱 Beginner Track (Weeks 1-4)

Goal: Understand databases and write basic queries

  • Complete Getting Started setup
  • Chapters 1-3: Background, Creating Databases, Query Primer
  • Exercises for Chapters 1-3
  • Project 1: Library Management System

Outcome: Can create databases, tables, and write SELECT queries with filtering and sorting


🌿 Intermediate Track (Weeks 5-10)

Goal: Master complex queries and data manipulation

  • Chapters 4-9: Filtering, Joins, Sets, Functions, Grouping, Subqueries
  • Exercises for Chapters 4-9
  • Project 2: E-Commerce Analysis
  • Project 3: Employee Database

Outcome: Can write complex multi-table queries with aggregations and subqueries


🌳 Advanced Track (Weeks 11-16)

Goal: Optimize performance and use advanced features

  • Chapters 10-18: Advanced Joins, Transactions, Indexes, Views, Analytics, Big Data
  • Exercises for Chapters 10-18
  • Project 4: Sales Reporting System
  • Performance tuning and optimization

Outcome: Can design efficient databases, optimize queries, and use advanced SQL features


πŸ’‘ Study Tips

Best Practices

  1. Practice Daily - Even 30 minutes a day is better than cramming
  2. Type Every Query - Don't copy-paste; muscle memory matters
  3. Experiment - Modify examples to see what happens
  4. Use Test Data - Practice on sample databases, not production!
  5. Read Execution Plans - Understand how queries actually run
  6. Document Your Learning - Keep a notebook or blog

Effective Learning Strategies

  • Pomodoro Technique: 25 min study + 5 min break
  • Active Recall: Try to write queries from memory
  • Spaced Repetition: Review older topics regularly
  • Teach Others: Explain concepts to solidify understanding
  • Build Projects: Apply skills to real-world scenarios

Common Pitfalls to Avoid

  • ❌ Skipping foundational concepts
  • ❌ Not practicing regularly
  • ❌ Copy-pasting without understanding
  • ❌ Ignoring error messages
  • ❌ Not learning to read execution plans
  • ❌ Forgetting to back up databases

πŸ› οΈ Tools & Resources

Recommended Tools

Tool Platform Purpose Cost
SQL Server 2022 All Database Engine Free
SSMS Windows Primary IDE Free
Azure Data Studio All Modern IDE Free
VS Code + mssql All Lightweight Editor Free
DBeaver All Universal Client Free

Learning Resources

Cheat Sheets


πŸ“Š Sample Database: Sakila

This course primarily uses the Sakila database, a sample database modeling a DVD rental store.

Database Overview

Tables:

  • actor - Movie actors
  • film - Film catalog
  • customer - Store customers
  • rental - Rental transactions
  • payment - Payment records
  • inventory - Store inventory
  • And more...

Features:

  • Realistic business scenario
  • Complex relationships
  • Multiple data types
  • Industry-standard schema

Schema Diagram: See 03-assets/er-diagrams/sakila-schema.png


🎯 Certification & Career

Skills You'll Gain

  • βœ… Write complex SQL queries for data retrieval and analysis
  • βœ… Design normalized database schemas
  • βœ… Optimize query performance with indexes
  • βœ… Implement transactions and maintain data integrity
  • βœ… Use advanced features (views, stored procedures, triggers)
  • βœ… Analyze and troubleshoot database issues
  • βœ… Work with real-world business scenarios

Career Paths

  • Database Administrator (DBA) - $90k-$130k
  • Data Analyst - $70k-$110k
  • Backend Developer - $80k-$140k
  • Data Engineer - $100k-$150k
  • Business Intelligence Developer - $85k-$125k

Relevant Certifications

  • Microsoft Certified: Azure Database Administrator Associate
  • Microsoft Certified: Data Analyst Associate
  • Oracle Database SQL Certified Associate

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

Ways to Contribute

  • πŸ› Report bugs and issues
  • πŸ’‘ Suggest new exercises or projects
  • πŸ“ Improve documentation
  • ✨ Add new features or content
  • 🌍 Translate content

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Sakila Database - Originally developed by MySQL AB
  • Microsoft - For SQL Server and excellent documentation
  • Open Source Community - For tools and resources
  • Contributors - Everyone who has contributed to this project

πŸ“ž Support & Community


πŸ—ΊοΈ Roadmap

Current Version: 1.0

  • βœ… Core SQL lessons (18 chapters)
  • βœ… Exercise sets for all chapters
  • βœ… 4 comprehensive projects
  • βœ… Sample databases and scripts

Planned Features

  • Video tutorials for each chapter
  • Interactive SQL sandbox
  • Additional practice databases
  • Advanced performance tuning module
  • Cloud database integration (Azure SQL, AWS RDS)
  • Docker containers for easy setup
  • Quiz/assessment system

⭐ Star This Repo

If you find this course helpful, please give it a star! It helps others discover this resource.


Get Started Now | View Lessons | Try Projects

Made with ❀️ for the SQL learning community


Last Updated: November 2025

About

A complete, project-based SQL learning path for absolute beginners to advanced database professionals

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages