Directly after SELECT
, it is possible to add SQL hints unique
or distinct
, which declare that this projection generates data containing unique values in the specified set of columns of a row-based or columnar table. This can be used to optimize subsequent subqueries executed on this projection, or for writing to table meta-attributes during INSERT
.
unique
- indicates unique or null
values. According to the SQL standard, each null is unique: NULL = NULL
-> NULL
.distinct
- indicates completely unique values including null: NULL IS DISTINCT FROM NULL
-> FALSE
.