Course Content
Introduction: How to Become a Data Analyst
How to Become a Data Analyst
0/1
Installing MySQL and create a database for Windows, MacOS, and Linux
How to Installing MySQL and create a database.
0/1
SELECT Statement and Where Clause in MySQL
Starting your Data Analysis Properly
0/2
LIMIT` + ALIASING` Group by+ Order By, Having Vs Where in MySQL
LIMIT` + ALIASING`
0/3
JOINS
Joins in MySQL
0/1
Unions in MySQL
Unions in MySQL
0/1
Window functions in MySQL
Window functions:- in MySQL
0/1
Common Table Expressions (CTEs) in MySQL and Temp Tables
Common Table Expressions (CTEs) in MySQL
0/2
stored procedures
stored procedures.
0/1
Triggers and Events in MySQL
Triggers and Events
0/1
Data Cleaning in MySQL
Data Cleaning in MySQL
0/1
MSQL EXPLORATORY DATA ANALYSIS
MSQL EXPLORATORY DATA ANALYSIS
0/1
Data Analyst Resume
Data Analyst Resume
0/1
How To Download Your Data Analyst Bootcamp Certification (Congrats!!)
How To Download Your Data Analyst Bootcamp Certification (Congrats!!)
0/1
Guide to Data Analysis for Beginners
About Lesson

Unions in MySQL 

In MySQL, “UNION’  is used to combine the results of two or more `SELECT` queries into a single result set. The queries must have the same number of columns and compatible data types. The main points to consider when using UNION are:

 

– UNION’  automatically removes duplicate rows.

– **UNION ALL” includes all duplicate rows in the result.

Syntax:-

SELECT column_list FROM table1

UNION [ALL]

SELECT column_list FROM table2;

Example:-

sql

SELECT id, name FROM customers

UNION

SELECT id, name FROM suppliers;

This query combines the results from the `customers` and `suppliers` tables, removing duplicates. If you want to keep duplicates, use `UNION ALL` instead.