Exam 1.4 Flashcards
(19 cards)
Relations operators
selection
projection
cross product
set difference
union
What is sign for selection and what it does
σ.cond sigma selects subset of rows from relation that mean condition
what is sign for projection and what it does
Π pi deletes unwanted rows from relation projection removes duplicatess
symbol for cross product and what it does
X cross produce allows combining relations
symbol for set difference and what it does
- takes tuples in relation 1 but not in relation 2
symbol for union and what it does
U takes tuples in relation 1 or relation 2
meaning of A ⊇ B
A contains all elements of B (B is a subset of A).
Meaning of A ⊆ B
A is a subset of B if all elements of A exist in B.
rename operator
works by doing pi(1->id, )
How does renaming work in SQL
rho p([new],p[oldname])
Conditional join of R ⋈ cS
take everything from R and S and apply condition to it
Equijoin
join condition consists of only inequalities
doesn’t drop tables that aren’t used
natural join
joins two tables with same name but drops tables that don’t have the same name
What is faster join or cross product
joins
what would this do -> pi (sname)
only show the sname column
what would this do -> (Temp1 ,sigma.bid = 103 Reserves)
only selects bid of 103 from reseves
what would this do p(temp1, sigma.bid = 103 Reserves)
copies bid of 103 in reserves to temp1
π.sname (π.sid ((π.bid σ.color=‘red’Boats) ⋈ Res) ⋈ Sailors)
Selects name of sailors who reserved a red boat
how does division work A/B are the tables
will give the tables in A that have columns in B