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

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

Lecture 06 Comp355

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

View Full Document
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!
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.

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

View Full Document
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
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.

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

View Full Document
= ) 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
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online