Thursday, 16 June 2016

Difference between Union and Union All

1. UNION removes duplicate rows.

“UNION ALL” does not remove the duplicate row. It returns all from all queries.

2. UNION uses a distinct sort.

“UNION ALL” does not use a distinct sort, so the performance of “UNION ALL” is slightly higher than “UNION”.

3. UNION cannot work with a column that has a TEXT data type.

UNION ALL can work with all data type columns.

No comments:

Post a Comment