SQL for Data Science
Master SQL essentials for data analysis — from basic queries and filtering to advanced window functions, subqueries, CTEs, and connecting databases from Python.
Your Learning Path
Follow these lessons in order, or jump to any topic that interests you.
1. Introduction
What is SQL, relational databases, tables, schemas, and why SQL matters for data science.
2. SELECT & Filtering
SELECT statements, WHERE clauses, operators, LIKE, IN, BETWEEN, ORDER BY, and LIMIT.
3. JOINs
INNER JOIN, LEFT/RIGHT/FULL OUTER JOIN, CROSS JOIN, self-joins, and multi-table queries.
4. Aggregation
COUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVING, and combining aggregates with filters.
5. Window Functions
RANK, ROW_NUMBER, DENSE_RANK, LAG, LEAD, NTILE, PARTITION BY, and running totals.
6. Subqueries & CTEs
Subqueries, correlated subqueries, WITH clauses (CTEs), recursive CTEs, and temp tables.
7. Best Practices
Query optimization, indexing, Python database connections, SQL style guides, and common pitfalls.
What You'll Learn
By the end of this course, you'll be able to:
Query Any Database
Write SELECT statements with complex filtering, sorting, and limiting to extract exactly the data you need.
Combine Tables
Use JOINs to merge data from multiple tables and understand relational database design.
Analyze Data with SQL
Aggregate, group, rank, and compute running totals using window functions and CTEs.
Connect SQL to Python
Use SQLAlchemy and pandas to run SQL queries from Python and integrate into data pipelines.
Lilly Tech Systems