Difference between union and union all in Oracle Pl/SQL

UNION is used to select distinct values from two tables.

UNION ALL is used to select all values (including duplicates) from the tables.

Example.

table1 has row (1,'Test')
table2 has row (1,'Test')

Union gives output
1,'Test'

Union all gives output
1,'Test'
1,'Test'

No comments:

Post a Comment

Please Provide your feedback here