> For the complete documentation index, see [llms.txt](https://til.kurianbenoy.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.kurianbenoy.com/databases/til-new-sql-operators-except-union-distinct.md).

# TIL New SQL Operators - Except, UNION, Distinct

**Except Operator**

The `EXCEPT` operator returns distinct rows from the first (left) query that are not in the output of the second (right) query

**Eg: select \* from table1**

**except**

**select \* from table 2**

Returns all elements in table1 not present in table2

**UNION and Intersect Operator**

In case of two queries in two tables. The Union and Intersect operator does the union and intersection of two sets.

![](/files/TUWJE1CKvB3Tk8CNCJZW)

**Distinct Operator**

In case of distinct operator, it returns all the unique values corresponding to a query value we want.

`SELECT DISTINCT(status) FROM employee;`
