> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations.md).

# Set Operations

{% columns %}
{% column %}
{% content-ref url="/pages/1oJMmBKSGVYE6JB1BjdS" %}
[Precedence Control in Table Operations](/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/precedence-control-in-table-operations.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Control the execution order of UNION, EXCEPT, and INTERSECT operations. Learn how to use parentheses to define explicit operation priority.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/IP1T2SB5nbOYnhA6AV4U" %}
[EXCEPT](/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/except.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Return rows from the first result set that do not appear in the second. This set operator performs a subtraction of two datasets.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/2wTe1MYQ6JIQrzoPNrMj" %}
[INTERSECT](/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/intersect.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Return only the rows that appear in both result sets. INTERSECT implicitly applies DISTINCT and follows the same column-naming, ORDER BY, and LIMIT rules as UNION.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/X7LZH3QOxYc9oQGg8QYj" %}
[MINUS](/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/minus.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Oracle-compatible synonym for the EXCEPT operator. It returns rows from the first query that are not present in the second query.
{% endcolumn %}
{% endcolumns %}

{% columns %}
{% column %}
{% content-ref url="/pages/lyiWu9orHSfvWgrBHYCN" %}
[UNION](/docs/server/reference/sql-statements/data-manipulation/selecting-data/set-operations/union.md)
{% endcontent-ref %}
{% endcolumn %}

{% column %}
Combine results from multiple SELECT statements into a single result set. This operator can optionally remove duplicates or include all rows.
{% endcolumn %}
{% endcolumns %}
