What is the difference between Union and Union All?
Cristopher Coronado
Select an image from your device to upload
Union- It combines two more queries and removes the duplicates.
UnionAll- It combines two more queries and keeps the duplicates.
For example: TableA has 1,2,3 and Table B has 3,4,5Union Result will be 1,2,3,4,5 (It removes the duplicate 3)Union All Result will be 1,2,3,3,4,5 (It keeps the duplicate 3)
Which one will be faster?Union All will be faster, as it does not remove the duplicates.