• A procedural query language which is used widely is known as Relational Algebra.
  • Instances of relation are given as input data and we get output as occurrences of relations
  • Relational algebra uses various operations to perform this input and output action.
  • In a relation sql relational query operations are performed recursively.
  • Output for the above operations is a new relation, which is formed from one or more input relations.

Types of Relational Operation

Select Operation

  • Tuples that satisfy a given predicate is selected by select operation.
  • It is denoted by sigma(σ).
  • Notation:  σ p(r)
    • Where (σ) is used for selection prediction.
    • R is used for relation,
    • p is used as a propositional logic formula which may use connectors like: AND OR and NOT.

Project Operation

  • List of attributes that wish to appear in the result is shown in project operation.
  • Remaining attributes are eleminated from the table.
  • It is denoted by ∏.

Union Operation

  • In union there are two tuples, R and S.
  • The union operation that contains all the tuples are either in R or S or both in R & S.
  • It eliminates the duplicate tuples. It is denoted by ∪.

Notation: R ∪ S

  • Following condition should be held by Union operation.
  • R and S must have the attribute of the same number.
  • Duplicate tuples are eliminated automatically.

Set Intersection

  • Let us consider there are two tuples R and S. The set intersection operation contains all tuples that are in both R & S.
  • It is denoted by intersection ∩.
  • Notation: R ∩ S

Cartesian product

  • The Cartesian product is used to combine each row in one table with each row in the other table. It is also known as a Cross product.
  • It is denoted by X.
  • Notation: E X D

Rename Operation

  • The rename operation is used to rename the output relation. It is denoted by rho(ρ).

 

Categorized in: