Use AI to generate UNION statements for combining results from multiple queries
Convert your text instructions into formulas or input a formula to have it explained.
Edit Excel online by chatting with AI
Convert your text instructions into SQL queries - powered by AI.
Generate Excel VBA (Visual Basic for Applications) code to automate tasks and create custom solutions within Microsoft Excel.
Upload your Excel file and generate beautiful charts with our AI-powered chart generator.
Convert your text into beautiful mind maps with our AI-powered mind map generator. Edit and customize your mind maps easily.
The SQL UNION operator is used to combine the result sets of two or more SELECT statements. It removes duplicate rows between the various SELECT statements. Each SELECT statement within the UNION must have the same number of columns in the result sets with similar data types.
SELECT column1, column2, ...
FROM table1
UNION
SELECT column1, column2, ...
FROM table2;
Consider two tables, Employees
and
Contractors
, both having columns
Name
and Age
.
SELECT Name, Age
FROM Employees
UNION
SELECT Name, Age
FROM Contractors;
This query will return a list of unique names and ages from both tables.
SELECT Name, Age
FROM Employees
UNION ALL
SELECT Name, Age
FROM Contractors;
For more advanced usage, consider combining UNION with other SQL clauses like WHERE, GROUP BY, and HAVING.