A hands-on exploration of SQL concepts using PostgreSQL, documenting my progression from basic queries to advanced analytical techniques.
- Master SQL fundamentals for data analysis and manipulation
- Understand relational database design and normalization
- Build practical querying skills for real-world data science workflows
- Complement Python/pandas skills with database-level data processing
- Database: PostgreSQL 16
- GUI Tool: pgAdmin 4
- Sample Data: DVD Rental Database (Northwind-style retail dataset)
- Core SELECT statements, filtering, and sorting
- Understanding DISTINCT and LIMIT
- File:
queries/01_basics/select_basics.sql
- GROUP BY, COUNT, SUM, AVG, MIN, MAX
- HAVING clause for filtered aggregations
- INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN
- Multi-table analysis and relationship mapping
- Common Table Expressions (WITH clauses)
- Nested queries and query optimization
- ROW_NUMBER, RANK, LAG, LEAD
- Analytical functions with PARTITION BY
sql-fundamentals/
├── queries/ # SQL scripts organized by topic
│ ├── 01_basics/
│ ├── 02_aggregations/
│ └── 03_joins/
├── data/ # Data files (.gitignored)
└── resources/ # Reference materials and documentation
- Install PostgreSQL
# macOS
brew install postgresql
# Windows: Download from postgresql.org-
Download Sample Database
- Get the DVD Rental database
- Extract
dvdrental.tar
-
Restore Database
# In pgAdmin: Right-click Databases → Create → Database (name: dvdrental)
# Right-click dvdrental → Restore → Select dvdrental.tar- Run Queries
- Open pgAdmin Query Tool
- Load scripts from
queries/folder - Execute and experiment!
- SQL vs Pandas: Understanding when to use SQL for large-scale data preprocessing vs pandas for in-memory analysis
- Query Optimization: Learning to think about data retrieval efficiency
- Relational Thinking: Transitioning from flat CSV mindset to normalized table structures
This repository documents my journey learning SQL as part of my data science skill development, alongside Python ETL and data analysis workflows.
Status: Actively learning | Last updated: February 2026