Home DBMS Introduction of Relational Algebra in DBMS

Introduction of Relational Algebra in DBMS

635
0
relational algebra in dbms

Relational Algebra in DBMS


Relational Algebra is a procedural and schematic query language, which takes instances of relations as input and yields instances of relations as output. It applies operators to perform queries. An operator can be either unary or binary. They receive relations as their input and yield relations as their output.

  • Gives a step by step process to obtain the result of the query.
  • Uses operators to perform queries.
  • Performs repeatedly on a relation.
  • Intermediate results are also considered relations.
  • An operator can be either unary or binary.
  • They accept relations as their input and arrange relations as their output.
  • Works on one or more relations to define another relation without changing the original relations.
  • Allows expressions to be nested, just as in arithmetic. This property is calledclosure’.

Types of Relational operation


Five basic operations in relational algebra: Selection, Projection, Union, Cartesian product and Set Difference.

types of relational algebra in dbms

Selection: [Notation- σp(r)]
It selects tuples that satisfy the given predicate from a relation. It works on a single relation R and defines a relation that contains only those tuples (rows) of R that
satisfy the specified condition. It is denoted by sigma (σ).


Projection: [Notation- ∏A1, A2, An (r)]
It projects column(s) that satisfy a given predicate. It works on a single relation R and defines a relation that contains a vertical subset of R, extracting the values of specified attributes and eliminating duplicates. It is denoted by ∏.


Union: [Notation- r U s]
It performs binary union between two given relations. Union of two relations R and S defines a relation that contains all the tuples of R, or S, or both R and S, duplicate tuples being eliminated. It is denoted by ∪.


Cartesian product: [Notation- E X D]
It defines a relation that is the concatenation of every tuple of relation R with every tuple of relation S. It is used to combine each row in one table with each row in the other table. It is denoted by X.


Set Difference: [Notation- R – S]
Defines a relation consisting of the tuples that are in relation R, but not in S. Suppose there are two tuples R and S, the set intersection operation contains all tuples that are in R but not in S. It is denoted by intersection minus (-).



also read:

HTML DBMS
Data Structure Aptitude
C Programming Reasoning
E-LEARNING
Previous articleData Structure: What is Array?
Next articleDatabase Architecture

LEAVE A REPLY

Please enter your comment!
Please enter your name here