√2011-09-04-Relational Calculus

√2011-09-04-Relational Calculus - Relational...

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

View Full Document Right Arrow Icon
Relational Calculus Database Management Systems, R. Ramakrishnan 1 Relational Calculus More “declarative” than relational algebra – Foundation for query languages (such as SQL) – Relational algebra used more for physical operators Comes in two flavours: Tuple relational calculus (TRC) Database Management Systems, R. Ramakrishnan 2 and Domain relational calculus (DRC) TRC : Variables range over (i.e., get bound to) tuples DRC : Variables range over domain elements (= field values) Both TRC and DRC are simple subsets of first-order logic We will study DRC Domain Relational Calculus Query has the form: xx x npxx x n 12 , ,..., | , ,..., Answer includes all tuples that x x xn , ,..., Database Management Systems, R. Ramakrishnan 3 make the formula be true . px x xn , ,..., Formula is recursively defined – Starting with simple atomic formulas – Logical connectives – Quantification
Background image of page 1

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

View Full DocumentRight Arrow Icon
DRC Formulas Atomic formula: , or X op Y, or X op constant op is one of Formula: x x x nR n a m e 12 , ,...,  ,,,,, Database Management Systems, R. Ramakrishnan 4 an atomic formula, or … (more later) Example of query with atomic formula Equivalent relational algebra query? } , , , | , , , { Sailors A T N I A T N I  DRC Formulas Formula: an atomic formula, or , where p and q are formulas, or (more later)  p p q p q ,, Database Management Systems, R. Ramakrishnan 5 Query using logical connectives Equivalent relational algebra query?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

√2011-09-04-Relational Calculus - Relational...

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

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