SELECT DISTINCT collapses duplicate projected rows.

highlighted = computed this step

DISTINCT is opt-in

SELECT DISTINCT asks SQL to collapse duplicate projected rows. Without that word, the bag remains a bag. Note: deduplication is explicit in this book.

distinct is explicit\text{distinct is explicit}

DISTINCT collapses the bag

Plain projection had row count 5, while DISTINCT recomputes row count 2. Note: the render shows the deduplicated result.

plain=5,distinct=2\text{plain}=5,\quad \text{distinct}=2

SQL bag/multiset + three-valued NULL logic, deterministic but surprising; tiny finite tables; no engine/perf claims. Set algebra is Book 1.

SELECT DISTINCT distinct course arity 1 rows 2 Grades arity 3 rows 5
select_distinct course DB OS

Summary

DISTINCT is the set-like escape hatch inside bag SQL. Note: bag multiplicity and NULL behavior are here; pure set algebra was Book One.

distinct summary\text{distinct summary}