
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

























NOTE: You will not be tested on how well you know SQL. Understanding the SQL introduced in class will be sufficient (a primer follows). SQL is described in Chapter 6, GMUW.
Select B,D
From R,S
Bingo! Got one...
Select B,D
From R,S
Where R.A = “c”
R.C=S.C
natural join
Select B,D
From R,S
a 1 10 10 x 2
b 1 20 20 y 2
c 2 10 30 z 2
d 2 35 40 x 1
e 3 45 50 y 3
c 7 15
=“c”
<c,2,10> (^) <10,x,2>
check=2?
output: <2,x>
next tuple: <c,7,15>
SELECT
B
S
R.A = “c”
R.C = S.C
D
Select B,D From R,S Where R.A = “c” ∧ R.C=S.C
parse
Query rewriting
Physical plan generation
execute
result
SQL query
parse tree
statistics logical query plan
physical query plan
Initial logical plan
“Best” logical plan
Logical plan
Rewrite rules
Select B,D From R,S
πB,D
σR.A = “c” Λ R.C = S.C