Table of Contents

About

Set - Difference in Relational Operator

set-difference is a relational operator that takes all Tuples in the relation 1, but not in relation 2

It's also known as:

  • except,
  • or minus

It returns all tuples (row) appearing in the first, but not the second of two union-compatible (ie same column, same type) relations.

Syntax

<MATH> R_1 - R_2 </MATH>

Duplicate

By default, it will remove all Tuples from the relation 1 even if it contains duplicate.

Example

  • Relation 1
Relation 1
1
1
2
  • Relation 2
Relation 2
1
2
  • Except
"Relation 1" EXCEPT "Relation 2"
// empty

Database