What is the difference between UNION and UNION ALL SQL syntax

Q

What is the difference between UNION and UNION ALL SQL syntax ?

✍: Guest

A

UNION SQL syntax is used to select information from two tables. But it selects only distinct records from both the table, while UNION ALL selects all records from both the tables.
Note : Selected records should have same datatype or else the syntax will not work.

2007-10-25, 4721👍, 0💬