Database

What is the difference between JOIN and UNION?

 

SQL JOIN allows us to “lookup” records on other table based on the given conditions between two tables. For example, if we have the department ID of each employee, then we can use this department ID of the employee table to join with the department ID of department table to lookup department names.
UNION operation allows us to add 2 similar data sets to create resulting data set that contains all the data from the source data sets. Union does not require any condition for joining. For example, if you have 2 employee tables with same structure, you can UNION them to create one result set that will contain all the employees from both of the tables.

SELECT * FROM EMP1
UNION
SELECT * FROM EMP2;

 

3 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Nice! Finally I understood the difference! Thank you!

    ReplyDelete
  3. MakeMkv Crack
    1.10.10 Crack is a video converting program. When you play a video and fail to open; there is nothing

    to worry it is very exclusive software which can convert the patents videos into easy format for any

    device. These videos you can play everywhere. This is famous for files format conversion and in other

    words it is known to transcoder.

    Movavi Screen Capture Crack
    Free download and activate your application.

    ReplyDelete

GitHub repository using Git Bash command

  To add a project to a GitHub repository using Git Bash command line, you can follow these steps: Create a new repository on GitHub by logg...