DSA Factory
Free Keys, ER and normalization lessonsKeys, ER and normalization · Stage 0 · Relations and keys · Step 2

Relational algebra

Selection, projection, join, union and the other operators that SQL is built on, and how to read an algebra expression. About 13 minutes.

Quick check

Which SQL does π_{city}(σ_{age > 30}(person)) correspond to?

  1. ASELECT DISTINCT city FROM person WHERE age > 30
  2. BSELECT city FROM person GROUP BY age HAVING age > 30
  3. CSELECT city FROM person JOIN person ON age > 30
Show the answer

SELECT DISTINCT city FROM person WHERE age > 30. Selection is WHERE, projection is SELECT, and projection removes duplicates.

Lock it in

4 questions on this idea

Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.

Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve