{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# L05 - Relational Query Languages Relational Calculus...

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

Relational Query Languages Relational Calculus

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

View Full Document
CS174A: Calculus 2 Relational Calculus ± Two flavors: Tuple relational calculus ( TRC ) Domain relational calculus ( DRC ) ± Calculus has variables , constants , comparison ops , logical connectives and quantifiers Variables range over (or get bound to) TRC : tuples (i.e. rows) DRC : domain elements (i.e. field values) Both TRC and DRC are subsets of first-order logic ± Expressions in the calculus are called formulas . An answer tuple is essentially an assignment to variables that makes the formula evaluate to true
CS174A: Calculus 3 ± Get the name and rating of sailors with rating at least 6 and older than 20 { ( n , r ) | ∃ s a Sailors ( s , n , r , a ) r ≥6 ∧ a >20} ± Get the red boats that are reserved by a sailor with rating at least 7 ( b ) b n s t Boats ( b , b n , “red” ) Reserves ( s , b , t ) ∧∃ n r a Sailors ( s , n , r , a ) r ≥7 DRC Examples Sailors (sid, sname, rating, age) Boats (bid, bname, color) Reserves (sid, bid, day)

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

View Full Document
CS174A: Calculus 4 Domain Relational Calculus (DRC) ± Query has the form: {( x 1 , x 2 , . .., x n ) | ϕ ( x 1 , x 2 , . .., x n )} ± Answer includes all tuples ( a 1 , a 2 , . .., a n ) that make the formula ϕ( a 1 , a 2 , . .., a n ) true ± Formula is recursively defined, starting with simple atomic formulas (checking tuples in relations or making comparisons of values), and building bigger and better formulas using the logical connectives
CS174A: Calculus 5 DRC Formulas ± Atomic formula : R ( x 1 , x 2 , . .., x

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 15

L05 - Relational Query Languages Relational Calculus...

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

View Full Document
Ask a homework question - tutors are online