Personal notes and reference guide covering SQL fundamentals, advanced queries, and database access with Python.
- Introduction to databases, RDBMS, and SQL
SELECTstatement: filtering, pattern matching, ranges, sortingCOUNT,DISTINCT,LIMIT,OFFSET- Grouping and aggregating with
GROUP BY,HAVING,AS INSERT,UPDATE,DELETEstatements
- Aggregate functions:
SUM,MIN,MAX,AVG,COUNT - Scalar and string functions
- Date and time functions
- Subqueries (nested
SELECTinWHERE,SELECT,FROM) - Accessing multiple tables: subqueries, implicit joins, explicit
JOINoperations
- Relational model, Entity-Relationship (ER) model
- Primary keys, foreign keys, and constraints
- DDL vs DML categories
CREATE TABLE,ALTER TABLE,DROP TABLE,TRUNCATE
- Python DB-API overview and workflow
- Connection objects and cursor objects
- SQL Magic in Jupyter Notebooks (
%sql,%%sql) - Exploratory Data Analysis with
pandasandseaborn - Practical case study: McDonald's nutritional dataset (SQLite + Python)
Matthieu Vanhoecke