Formal Relational Query Languages

3 important questions on Formal Relational Query Languages

What is Relational Algebra and why do we use it for SQL and working with databases in in general?

Relational Algebra.
  • A procedural query language, containing a collection of operations.
  • These operations help to create a new relation from one/two existing relations:
    • Input:
      • It always takes one or two relations as input.
    • Output:
      • It always produces a new relation.

We can divide relational algebra's fundamental operations into unary and binary operations. What is the difference between the two and which operations fall under which category?

Unary Operations:
  • Operations that work on a single relation.
  • Fundamental Unary Operations:
    • Selection (σ).
    • Projection (π).
    • Renaming (ρ).
Binary Operations:
  • Operations that work on two relations.
  • Fundamental Binary Operations:
    • Union (∪).
    • Difference (−).
    • Cartesian Product (×).
    • Join (⨝).

Consider the following query in Tuple Relational Calculus.
What does ∈ mean?

  • It means "is an element of."
    • Used tot state that an object (in this case a tuple) belongs to a collection.
    • E.g., t = {1, 2, 3, 4}.
      • We can say: 2 ∈ t.
        • 2 is an element of t.
  • In {t | t  ∈ instructor... }:
    • Means: find all tuples ( t ) that are members of the set of tuples that makes up the instructor relation.

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo