SQL & Databases

Talk to data — query, filter and join like a professional.

Introduction to Databases and SQL

Meet the database that powers every app — then watch your first SQL query travel the pipeline and come back as rows.

Data Definition Language (DDL)

Build a school database from nothing: CREATE the tables, ALTER them when plans change, DROP them when they must go.

Data Types and Constraints

Give every column a type and every table rules — then watch four guards reject the rows that break them.

Data Manipulation (INSERT, UPDATE, DELETE)

INSERT adds rows, UPDATE rewrites them, DELETE removes them — three verbs, one golden rule: mind your WHERE.

SELECT Basics

Ask a table for exactly the columns you want and watch the result grid fill, one projected row at a time.

Filtering with WHERE

Teach the engine to say no — watch WHERE test every row against your condition and keep only the survivors.

Sorting and Limiting

Turn a jumbled table into a leaderboard: ORDER BY lines the rows up and LIMIT keeps only the top of the list.

Aggregate Functions

Six rows in, one number out — watch COUNT, SUM, AVG, MIN and MAX squeeze a whole table into a single row.

GROUP BY and HAVING

Bucket rows by city, count each bucket, then let HAVING throw away the groups that are too small to matter.

INNER and OUTER Joins

Two tables, one answer — watch INNER JOIN link matching rows, and see what LEFT JOIN would do with the leftovers.

Cross and Self Joins

Meet the wildest joins: CROSS JOIN pairs every row with every row, while a self-join makes one table play two roles.

Subqueries

A query inside a query — watch the engine run the inner SELECT first and feed its answer to the outer one.

Set Operations

UNION stacks, INTERSECT overlaps, EXCEPT subtracts — combine whole result grids like building blocks.

Common Table Expressions (CTEs)

Give a subquery a name and reuse it — watch a WITH clause build a temporary result the main query can read.

Window Functions

Rank rows without squashing them — watch RANK() OVER PARTITION stamp every employee with a per-department rank.

Views

Save a query under a name and query it like a table — watch CREATE VIEW and a SELECT from the view run.

Indexes and Performance

Why some queries fly and others crawl — watch CREATE INDEX turn a slow full-table scan into an instant seek.

Transactions and ACID

All or nothing — watch BEGIN, COMMIT and ROLLBACK group bank transfers so they land together or not at all.

Stored Procedures and Functions

Store whole SQL mini-programs inside the database — then run them with one CALL instead of ten statements.

Triggers and Events

Make the database react on its own — watch an UPDATE fire a trigger that quietly writes an audit row.