Lecture 06 - Lecture 06 Comp355 Formal Relational Query...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 06 Comp355
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Formal Relational Query Languages mathematical Query Languages form the basis for “real” languages (e.g. SQL), and for implementation: Relational Algebra : More operational , very useful for representing execution plans.    Understanding Algebra is key to understanding SQL, and query processing!  
Background image of page 2
Example Instances sid sname rating age 22 dustin 7 45.0 31 lubber 8 55.5 58 rusty 10 35.0 sid sname rating age 28 yuppy 9 35.0 31 lubber 8 55.5 44 guppy 5 35.0 58 rusty 10 35.0 sid bid day 22 101 10/10/96 58 103 11/12/96 R1 S1 S2 “Sailors” and “Reserves” relations for our examples.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Algebra Operations Look what we want to get from the following table: sid sname rating age 28 yuppy 9 35.0 31 lubber 8 55.5 44 guppy 5 35.0 58 rusty 10 35.0
Background image of page 4
Projection sname rating yuppy 9 lubber 8 guppy 5 rusty 10 π sname rating S , ( ) 2 age 35.0 55.5 age S ( ) 2 Deletes attributes that are not in projection list . Schema of result contains exactly the fields in the projection list, with the same names that they had in the (only) input relation. Projection operator will eliminate duplicates ! Note: real systems typically don’t do duplicate elimination unless the user explicitly asks for it.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
= ) 2 ( 8 S rating σ sid sname rating age 28 yuppy 9 35.0 58 rusty 10 35.0 Selects rows that satisfy selection condition . No duplicates in result! Schema of result identical to schema of (only) input relation. S2
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 22

Lecture 06 - Lecture 06 Comp355 Formal Relational Query...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online