CS-GY 6083: Principles of Database Systems
main
main
  • Introduction
  • DBMS Basics
    • Introduction to DBMS
    • Why use a DBMS instead of a File System?
    • Levels of Abstraction
    • Instances and Schemas
  • Data Models
    • Introduction to Data Models
    • Database Languages
    • Database Design
  • DBMS Internals
    • Introduction to DBMS Internals
    • Storage Manager
    • Query Processor
    • Transaction Management
    • Database Users
    • Database Architecture
  • DBMS History
  • Some Popular Database Systems
  • OLTP, OLAP, and Data Mining
  • Databases vs. Information Retrieval
  • The Entity-Relationship Model - Details
    • Introduction
    • Cardinality Constraints
    • ER Diagram Components
    • ER Diagram to Relational Schema
    • Design Issues
  • The Relational Model - Details
    • Relations
    • Keys
    • Relational Query Languages
      • Relational Algebra
      • Relational Calculus
      • Relative Expressive Power
    • Relational Operators
  • SQL
    • Introduction to SQL
    • Domain Types in SQL
    • DDL Commands
      • Creating a Table
      • Alter and Drop
    • DML Commands
      • Basic Query Structure
      • Select
      • From
      • Where
      • Joins
      • Rename
      • String Operations
      • Ordering
      • Set Operations
      • Group By and Having
      • Nested Subqueries
      • Test for Empty Relations
      • Test for Duplicate Tuples
      • Derived Relations
      • With
      • Database Modification
    • Intermediate SQL
      • Joins Revisited
      • Views
      • Transactions
      • Integrity Constraints
      • More SQL Data Types and Schemas
        • Other Features
      • Authorization
    • Advanced SQL
      • Accessing SQL From a Programming Language
        • ODBC and JDBC
        • Embedded SQL
        • PHP
        • Some Security Issues
      • Accessing Metadata
      • Text Operations
        • Like
        • Contains
      • Cursors
      • Functions and Procedures
        • Procedural Constructs
        • External Language Routines
      • Triggers
      • Ranking
      • Windowing
      • OLAP
Powered by GitBook
On this page
  • Tuple Relational Calculus
  • Domain Relational Calculus

Was this helpful?

  1. The Relational Model - Details
  2. Relational Query Languages

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

  • t ∈\in∈ r denotes that tuple t is in relation r

  • 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:

      ∃\exists∃ t∈\in∈r (Q (t)) ≡ "there exists" a tuple t in relation r such that predicate Q(t) is true

      ∀\forall∀ t∈\in∈r (Q (t)) ≡ Q(t) is true "for all" tuples t in relation r

  • 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

  • An expression in domain relational calculus is denoted as follows: {<x1,x2,...xnx_1, x_2, ... x_nx1​,x2​,...xn​>|P(x1,x2,...,xnx_1, x_2, ..., x_nx1​,x2​,...,xn​)}

    where x1,x2,...,xnx_1, x_2, ..., x_nx1​,x2​,...,xn​ are domain variables and P is the predicate

  • 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}

PreviousRelational AlgebraNextRelative Expressive Power

Last updated 4 years ago

Was this helpful?