UNION JOIN
The UNION
operation is used to combine two queries. Let's look at the syntax:
SELECT [COLUMNS LIST] FROM [TABLE NAME] UNION SELECT [COLUMNS LIST] FROM [TABLE NAME]
However, the most important point to remember when we use the UNION
operation is to ensure the following:
- Both query columns have similar data types
- Both query columns are in the same order
Let's take a look at the following exercise to see how the UNION
query functions.
Exercise 6.05: Implementing a UNION JOIN
The store manager wants a telephonic feedback survey from everyone who the store employees work with. This implies that there's a list of suppliers and customers and their full names, along with their contact numbers. To do this, perform the following steps:
- In a new query window, write the following query:
SELECT CONCAT(Customers.FirstName,' ',Customers.LastName) as 'FULL NAME', Â Â Â Â Â Â Â Â Customers...