ch5 - Chapter5: ,5thEd Silberschatz,KorthandSudarshan...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
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 
Image of page 1

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

View Full Document Right Arrow Icon
© 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
Image of page 2
© 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  ( ) } It is the set of all tuples  t  such that predicate  P  is true for  t t  is a  tuple variable [ ] 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
Image of page 3

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

View Full Document Right Arrow Icon
© 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 ( ( ))   ”there exists” a tuple in  t  in relation  r                         such that predicate  ( ) is true 2200 r  ( ( ))  Q  is true “for all” tuples  t  in relation  r
Image of page 4
© 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  )
Image of page 5

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

View Full Document Right Arrow Icon
© 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         { |   5  s  loan ( [ loan_number  ] =  [ 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}
Image of page 6
© Silberschatz, Korth and Sudarshan 5.<number> Database System Concepts , 5 th  Ed., Aug 2005
Image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern