Relational set operators Flashcards
SELECT, PROJECT, JOIN, INTERSECT, UNION, DIFFERENCE
SELECT
σ A (R)
ex: σ Length_mRNA >1500
^ Length_mRNA < 2000 (GENE)
This translates to “select from gene table the attribute Length_mRNA that is between 1500 and 2000”.
PROJECT
a form of restriction which restrict the subset of
columns that will be returned
ex: π gene_symbol, location (GENE)
This translates to “project from gene table the attributes gene_symbol and location”.
JOIN
|X| (GENE.GeneID = EXPRESSION.GeneID)
INTERSECT
returns those rows common to the specified relations
Symbol: ∩
Example:
σ Length_mRNA = 2000 (GENE)
∩
σ ExpressionLevel > 5 (EXPRESSION)
SELECT * FROM A
INTERSECT
SELECT * FROM B
This is similar to INNER JOIN
UNION
combines all of the rows from the
specified tables BUT excludes duplicates
Symbol: ∪
Example:
σ Length_mRNA = 2000 (GENE)
∪
σ ExpressionLevel > 5 (EXPRESSION)
SELECT * FROM A
UNION
SELECT * FROM B
DIFFERENCE
turns all rows from
one table that are NOT in another
Symbol: -
Example:
σ Length_mRNA = 2000 (GENE)
−
σ ExpressionLevel > 5 (EXPRESSION)
SELECT * FROM A
EXCEPT
SELECT * FROM B
operators used
+, -, =, <, >, /=, <=,>=
and, or, not
^, ∨, ¬