
Creating Tables: DDL for Python Devs
Map Python types to SQL types. Learn CREATE TABLE with primary keys, foreign keys, and constraints like NOT NULL and DEFAULT.

Map Python types to SQL types. Learn CREATE TABLE with primary keys, foreign keys, and constraints like NOT NULL and DEFAULT.

Calculate across rows without collapsing them. Running totals, rankings, and row comparisons that GROUP BY can't do.

NULL means unknown, not empty. Why NULL = NULL isn't true, three-valued logic, and how NULL behaves in WHERE, GROUP BY, JOINs and subqueries.

WITH clauses let you name your subqueries and read top-to-bottom instead of inside-out. Transform nested spaghetti into clean steps.

Nest queries inside queries, like Python helper functions. Use them in WHERE, SELECT, or FROM to compute intermediate results.
SQL is still heavily entrenched in corporate systems. No-SQL didn't kill it, and so far, AI hasn't killed it. I'm curious is SQL practitioners will become more...

Connect related tables like looking up values in a Python dictionary. Covers INNER JOIN, LEFT JOIN, and when to use each.

WHERE filters rows before grouping; HAVING filters after. Need "only cities with more than 10 customers"? That's HAVING.

GROUP BY creates buckets and counts them. It's like Python's `collections.Counter` or pandas `groupby()`. Learn COUNT, SUM, AVG, MIN, and MAX.

Filter rows with conditions, the SQL equivalent of list comprehension `if` clauses. Covers AND/OR, IN, BETWEEN, LIKE patterns, and NULL handling.