Projection keeps selected columns and deduplicates the resulting row set.

highlighted = computed this step

Projection chooses columns

Projection keeps named columns in the requested order. Because the result is still a set, duplicate projected rows collapse. Note: the diagrams show when that collapse happens.

π chooses columns\pi\text{ chooses columns}

Projection can deduplicate

The input row count is 3 and the recomputed output row count is 2. Note: duplicate projected values collapse because the output is a set.

in=3,out=2\text{in}=3,\quad \text{out}=2

set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims

Projectionproject coursearity 1 rows 2Enrollarity 2 rows 3
projectcourseDBOS

Projection may keep cardinality

The contrast projection has input row count 3 and recomputed output row count 3. Note: no collapse occurs when every projected value remains distinct.

in=3,out=3\text{in}=3,\quad \text{out}=3

set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims

Projection contrastproject sidarity 1 rows 3Studentsarity 2 rows 3
projectsids1s2s3

Summary

Projection changes arity and may change cardinality after deduplication. Note: SQL can preserve duplicates in ordinary query results; that bag boundary is for the next book.

projection summary\text{projection summary}