Q:
What is the difference between JOIN and UNION?
Answer
SQL JOIN allows access to records of other table based on the given conditions between two tables.
Ex: If we are provided with the department ID of each employee, then we can use the department ID of the employee table to merge with the department ID of the department table to access department names.
UNION operation allows addition of 2 similar data sets to create a resulting set that contains all the data from the source data sets.
Ex: If we are provided with 2 employee tables of the same structure, we can UNION them to create a singular result that will contain all employee from both the table.
View answer
Workspace
Report Error
Discuss