Minus

From Oracle FAQ
Jump to: navigation, search

MINUS is a SQL set operation that selects elements from the first table and then removes rows that are also returned by the second SELECT statement.

For example, the below query will return all rows that are in table_A, but not in table_B:

SELECT * FROM table_A
MINUS
SELECT * FROM table_B;

Additionally, if there are two identical rows in table_A, and that same row exists in table_B, BOTH rows from table_A will be removed from the result set.

[edit] Also see

  • Intersect - only return rows that are in both tables
  • Union - combine rows from tables and remove duplicates
  • Union all combine rows from tables without removing duplicates
Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #