UNION DISTINCT
combines the two results and removes duplicatesSELECT *
FROM students
WHERE id < 10
UNION DISTINCT
SELECT *
FROM students
WHERE id > 5
The query is equivalent to the above query because DISTINCT
is the default behaviorSELECT *
FROM students
WHERE id < 10
UNION
SELECT *
FROM students
WHERE id > 5