How to represent "not exists" in relational algebra?

sudh picture sudh · Sep 17, 2010 · Viewed 8.6k times · Source

How do I represent the SQL "not exists" clause in relational algebra?

Answer

user2262867 picture user2262867 · Jan 26, 2020

The SQL NOT EXISTS construct can be represented in relational algebra by the antijoin .

The antijoin L ▹ R of two relations L and R selects those tuples of L that do not join with any tuple in R. It can be defined in terms of set difference and left semijoin as follows:

L ▹ R = L - (L ⋉ R).