MINUS ALL (table operator)


BigQueryDb2 (LUW)DerbyH2MariaDBMySQLOracle DBPostgreSQLSQL ServerSQLite20052007200920112013201520172019202120233.5.7 - 3.50.02008R2 - 20228.3 - 17a21c - 23.9a11gR1 - 19c8.0.31 - 9.3.0a5.0 - 8.0.3010.5 - 12.0.2a5.1 - 10.41.4.192 - 2.3.23210.16.1.1 - 10.17.1.0a9.7 - 12.1.2a2.0
  1. Supports the standard SQL syntax: except all

Not a Standardized Feature

This functionality is not described by the SQL standard ISO/IEC 9075-2:2023. Prefer using the more widely supported except all.

The table operator minus all returns the rows of the first result except those that are also in the second.

SELECT …
  FROM …
MINUS ALL
SELECT …
  FROM …

As with all table operators both sides of minus must have the same number of columns and their types must be compatible based on their position. All null values are considered being the same (not distinct) for this operation.

Each occurrence of a row-value in the second result will remove of appearance of this row-value from the first result.

Normative References

The table operation minus all is not covered by any international standard.

You can’t catch up on 20 years of SQL evolution in one day. Subscribe the newsletter via E-Mail, Bluesky or RSS to gradually catch up and to keep modern-⁠sql.com on your radar.

About the Author

Photo of Markus Winand

Markus Winand provides insights into SQL and shows how different systems support it at modern-sql.com. Previously he made use-the-index-luke.com, which is still actively maintained. Markus can be hired as trainer, speaker and consultant via winand.at.

Buy the Book

Cover of “SQL Performance Explained”: Squirrel running on grass

The essence of SQL tuning in 200 pages

Buy now!
(paperback and/or PDF)

Paperback also available at Amazon.com.

Hire Markus

Markus offers SQL training and consulting for developers working at companies of all sizes.
Learn more »

Connect with Markus Winand

Subscribe mailinglistsSubscribe the RSS feedMarkus Winand on LinkedInMarkus Winand on XINGMarkus Winand on TwitterMarkus Winand on Bluesky
Copyright 2015-2025 Markus Winand. All righs reserved.
Legal | Contact | NO WARRANTY | Trademarks | Privacy and GDPR