Categories
MySQL

MySQL UNION Operator

Using MySQL UNION Operator you can combine two or more result set from a multiple table into a single result set.

UNION operator eliminates duplicate rows from the result set even you forgot to use DISTINCT operator. UNION ALL allows duplicate rows remain in the result.

You may like:  MySQL LIKE Operator

In the corresponding SELECT statements the number of columns appears must be equal.

Example of UNION:

SELECT userID id, userName name
FROM users
UNION
SELECT orderUser id, orderName name
FROM orders

Here we combine the data from users and orders tables into a single result set.

Avatar for Namaste UI (Author)

By Namaste UI (Author)

Namaste UI collaborates closely with clients to develop tailored guest posting strategies that align with their unique goals and target audiences. Their commitment to delivering high-quality, niche-specific content ensures that each guest post not only meets but exceeds the expectations of both clients and the hosting platforms. Connect with us on social media for the latest updates on guest posting trends, outreach strategies, and digital marketing tips. For any types of guest posting services, contact us on info[at]namasteui.com.

Leave a Reply

Your email address will not be published. Required fields are marked *