ch5 - Database System Concepts 5th Ed ©Silberschatz Korth...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Database System Concepts, 5th Ed . ©Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use Chapter 5: Other Relational Languages Chapter 5: Other Relational Languages ©Silberschatz, Korth and Sudarshan 5.<number> Database System Concepts , 5 th Ed., Aug 2005 Chapter 5: Other Relational Languages Chapter 5: Other Relational Languages ■ Tuple Relational Calculus ■ Domain Relational Calculus ■ Query-by-Example (QBE) ■ Datalog ©Silberschatz, Korth and Sudarshan 5.<number> Database System Concepts , 5 th Ed., Aug 2005 Tuple Relational Calculus Tuple Relational Calculus ■ A nonprocedural query language, where each query is of the form { t | P ( t ) } ■ It is the set of all tuples t such that predicate P is true for t ■ t is a tuple variable , t [ A ] denotes the value of tuple t on attribute A ■ t ∈ r denotes that tuple t is in relation r ■ P is a formula similar to that of the predicate calculus ©Silberschatz, Korth and Sudarshan 5.<number> Database System Concepts , 5 th Ed., Aug 2005 Predicate Calculus Formula Predicate Calculus Formula 1. Set of attributes and constants 2. Set of comparison operators: (e.g., < , ≤ , = , ≠ , , ≥ ) 3. Set of connectives: and ( ∧ ), or (v)‚ not ( ¬ ) 4. Implication ( ⇒ ): x ⇒ y, if x if true, then y is true x ⇒ y ≡ ¬ x v y 5. Set of quantifiers: 5 t ∈ r ( Q ( t )) ≡ ”there exists” a tuple in t in relation r such that predicate Q ( t ) is true 2200 t ∈ r ( Q ( t )) ≡ Q is true “for all” tuples t in relation r ©Silberschatz, Korth and Sudarshan 5.<number> Database System Concepts , 5 th Ed., Aug 2005 Banking Example Banking Example ■ branch ( branch_name, branch_city, assets ) ■ customer ( customer_name, customer_street, customer_city ) ■ account ( account_number, branch_name, balance ) ■ loan ( loan_number, branch_name, amount ) ■ depositor ( customer_name, account_number ) ■ borrower ( customer_name, loan_number ) ©Silberschatz, Korth and Sudarshan 5.<number> Database System Concepts , 5 th Ed., Aug 2005 Example Queries Example Queries ■ Find the loan_number, branch_name, and amount for loans of over $1200 ■ Find the loan number for each loan of an amount greater than $1200 { t | 5 s ∈ loan ( t [ loan_number ] = s [ loan_number ] ∧ s [ amount ] 1200)} Notice that a relation on schema [ loan_number ] is implicitly defined by the query { t | t ∈ loan ∧ t [ amount ] 1200} ©Silberschatz, Korth and Sudarshan...
View Full Document

This note was uploaded on 04/28/2010 for the course CSE cse123 taught by Professor Benny during the Spring '10 term at LSU Eunice.

Page1 / 84

ch5 - Database System Concepts 5th Ed ©Silberschatz Korth...

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