Test for Duplicate Tuples

The unique construct tests whether a subquery has any duplicate tuples in its result.

Ex. Find all courses that were offered at most once in 2009:

select T.course_id
from course T
where unique (select R.course_id from section R where T.course_id= R.course_id and R.year=2009);

Last updated