---
title: "What is Union, minus and Interact commands?"  
description: "What is Union, minus and Interact commands?"  
author: "Anonymous User"  
published: 2019-09-12  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/33599/what-is-union-minus-and-interact-commands  
category: "sqlite"  
tags: ["database", "sql server"]  
reading_time: 2 minutes  

---

# What is Union, minus and Interact commands?

The **UNION** operator is used to combining the results of two tables, and it eliminates duplicate rows from the tables.

```
SELECT * FROM table1
UNION
SELECT * FROM table2;    
```

The **MINUS** operator is used to returning rows from the first query but not from the second query. The matching records of the first and second query and other rows from the first query will be displayed as a result set.

```
SELECT * FROM table1
MINUS
SELECT * FROM table2;
```

The **INTERSECT** operator is used to return rows returned by both the queries.

```
SELECT * FROM table1
INTERSECT
SELECT * FROM table2;
```

## Answers

### Answer by Anonymous User

The **UNION** operator is used to combining the results of two tables, and it eliminates duplicate rows from the tables.

```
SELECT * FROM table1
UNION
SELECT * FROM table2;    
```

The **MINUS** operator is used to returning rows from the first query but not from the second query. The matching records of the first and second query and other rows from the first query will be displayed as a result set.

```
SELECT * FROM table1
MINUS
SELECT * FROM table2;
```

The **INTERSECT** operator is used to return rows returned by both the queries.

```
SELECT * FROM table1
INTERSECT
SELECT * FROM table2;
```


---

Original Source: https://www.mindstick.com/interview/33599/what-is-union-minus-and-interact-commands

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
