---
title: "Difference between SQL Union VS Union All."  
description: "Difference between SQL Union VS Union All."  
author: "Anubhav Sharma"  
published: 2026-04-20  
updated: 2026-04-28  
canonical: https://answers.mindstick.com/qa/116528/difference-between-sql-union-vs-union-all  
category: "database"  
tags: ["database", "sql server"]  
reading_time: 1 minute  

---

# Difference between SQL Union VS Union All.

**[Difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between [SQL Union](https://www.mindstick.com/forum/33565/sql-union-operator) VS [Union All](https://www.mindstick.com/blog/11268/union-and-union-all-operator-in-sql).**

## Answers

### Answer by Anubhav Sharma

`UNION`

1. Removes duplicate rows
2. Performs extra sorting/comparison → **slower**
3. Use when you need **unique results only**

`UNION ALL`

1. Keeps all rows (including duplicates)
2. No duplicate check → **faster**
3. Use when duplicates are acceptable or needed

## Example:

```plaintext
SELECT Name FROM Students
UNION
SELECT Name FROM Teachers;
-- returns unique names only

SELECT Name FROM Students
UNION ALL
SELECT Name FROM Teachers;
-- returns all names including duplicates
```


---

Original Source: https://answers.mindstick.com/qa/116528/difference-between-sql-union-vs-union-all

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
