AlgoPlus//structures / relational-algebra
Read the theory

Relational Algebra

The formal operators behind every SQL query — applied to live relations.

Operator
Step
1/1
Operator
Legend
Kept columns (π)
Kept rows (σ)
Discarded
AI Tutor Workspace
In a nutshell
Relational algebra is the small set of operations every SQL query is built from. Each one takes one or two tables and produces a new table: selection keeps the rows that pass a test, projection keeps only the columns you name, join stitches two tables together on a shared value, and union and difference combine two same-shaped tables. Because the output is itself a table, you can chain the operators to express any query.
Ready
Press play to begin the cinematic walkthrough.
Relational algebra is the math under SQL: selection keeps rows, projection keeps columns, join stitches relations on a shared value, and set ops combine union-compatible relations. Queries are just compositions of these operators.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for Relational Algebra.