Relational Algebra Flashcards
Relational Query Languages do what?
allow the manipulation and retrieval of data from a database
two types of query languages
declarative, procedural
Declarative query language
describe what a user wants, rather than how to compute it (TRC, DRC)
Procedural query language
operational, useful for representing execution plans (relational alg)
relational query languages
can’t capture any type of computation, not intended for complex computations
algebra
operands - varialbes or values from which new values can be constructed
operators - symbols denoting procedures that construct new values from given values
relational algebra
an algebra whose operands are relations or variables that represent relations
Selection
Oc(R)
outputs the rows of R that satisfy C
Projection
PIa(R)
outputs only the columns A1, A2, …An, removes duplicate tuples
Union R1 U R2
outputs all tuples in R1 or R2
Difference
R1 - R2
outputs all tuples in R1 and not in R2
Cross Product
R1 x R2
matches each tuples in R1 with each tuple in R2
Renaming
Pa(R)
does not change the instance, only the schema
Intersection
R1 ^ R2
outputs all tuples in R1 and R2
Theta Join
Cross product followed by a selection
condition = any boolean valued condition