Difference between union and union all.


  • UNION removes duplicate rows, whereas UNION ALL doesn't.
  • UNION have to perform distinct sort to remove duplicates, which makes it less faster than UNION ALL.
Note :- All selected columns need to be of the same data type.


Differences between JOIN and UNION
  • UNION combines the result set of two or more select queries into a single result set which includes all the rows from all the queries in the UNION, where as JOIN retrieves data from two or more tables based on logical relationships between the tables.
  • In short, UNION combines rows from 2 or more tables, where JOIN combines columns from 2 or more tables.

Share

& Comment

0 comments:

Post a Comment

 

Copyright © 2019 HART™ is a registered trademark.