Relational Calculus

Tuple Relational Calculus

  • It is a non-procedural query language

  • This means that it will mention the required information without specifying the procedure to obtain it

  • An expression in tuple relational calculus is denoted as follows: {t | P(t)}

  • In other words, it is the set of all tuples t such that predicate P is true for t

  • t is a tuple variable and t[A] denotes the value of tuple t for attribute A

  • The predicate can contain:

    • A set of attributes and constants

    • A set of comparison operators: (<, ≤, =, ≠, >, ≥)

    • A set of connectives: and (∧), or (v)‚ not (¬)

    • An implication (⇒): x ⇒ y, i.e. if x if true, then y is true

      x ⇒ y ≡ ¬x v y

    • A set of quantifiers:

  • Ex. Finding ID, name, dept_name and salary of all instructors who have salary greater than 80000: {t | t ∈ instructor ∧ t [salary] > 80000}

Domain Relational Calculus

  • It is a non-procedural language as well

  • It is as powerful as tuple relational calculus

  • Ex. Finding ID, name, dept_name and salary of all instructors who have salary greater than 80000:

    {<i, n, d, s> | <i, n, d, s> ∈ instructor ∧ s > 80000}

Last updated