A structured collection of SQL exercises using PostgreSQL databases for film rental and flight booking scenarios.
sql-learning/
├── sql-exercises/ # All SQL practice files (89 files)
├── databases/ # Database schemas and setup
├── docs/ # Documentation and reference
└── README.md # This file
- PostgreSQL 13 or higher
- pgAdmin or similar database client
- Install PostgreSQL
- Create databases:
CREATE DATABASE greencycle_rental; CREATE DATABASE flights_booking;
- Download databases from Kaggle
SQL exercises are organized by difficulty level and topic in the sql-exercises/
directory:
- L1_ - Level 1 Fundamentals (SELECT, WHERE, basic functions)
- L2_ - Level 2 Intermediate (JOINs, GROUP BY, subqueries)
- L3_ - Level 3 Advanced (Window functions, complex analytics)
- L4_ - Level 4 Administration (DDL, views, procedures, security)
- P1-P3_ - Business Projects (GreenCycle, Employee, Advanced analysis)
- PRACTICE_ - Challenge exercises
- GreenCycle Database: Film rental business with customers, films, and rental transactions
- Flights Database: Flight booking system with airports, flights, and passenger data
See databases/database-schemas/
for entity relationship diagrams.
- Level 1 Fundamentals: Start with
L1_SELECT-basics-customer-data.sql
- Level 2 Intermediate: Progress to
L2_JOIN-*
andL2_GROUP-*
files - Level 3 Advanced: Master
L3_WINDOW-*
andL3_SUBQUERY-*
files - Level 4 Administration: Complete
L4_DDL-*
andL4_PROCEDURES-*
files - Business Projects: Apply skills with
P1_FILMS-*
,P2_EMPLOYEES-*
files - Practice Challenges: Test knowledge with
PRACTICE_*
files
Additional reference materials are available in the docs/
directory.