Explain rename operation in relational algebra (DBMS)?

DBMSDatabaseBig Data Analytics

Query is a question or requesting information. Query language is a language which is used to retrieve information from a database.

Query language is divided into two types −

  • Procedural language

  • Non-procedural language

Procedural language

Information is retrieved from the database by specifying the sequence of operations to be performed.

For Example − Relational algebra.

Structure Query language (SQL) is based on relational algebra.

Relational algebra consists of a set of operations that take one or two relations as an input and produces a new relation as output.

Types of Relational Algebra operations

The different types of relational algebra operations are as follows −

  • Select operation

  • Project operation

  • Rename operation

  • Union operation

  • Intersection operation

  • Difference operation

  • Cartesian product operation

  • Join operation

  • Division operation

Select, project, rename comes under unary operation (operate on one table).

Rename operation

It is used to assign a new name to a relation and is denoted by ρ (rho).

Syntax

ρnewname (tablename or expression)

Consider the student table given below −

RegnoBranchSection
1CSEA
2ECEB
3CIVILB
4ITA

Example 1

The student table is renamed with newstudent with the help of the following command −

ρnewstudent (student)

Example 2

The name, branch column of student table are renamed and newbranch respectively

ρnewname,newbranch(∏name,branch( student))

Binary operations are applied on two compatible relations.

Two relations R1, R2 are to be compatible if they are of the same degree and the domains of corresponding attributes are the same.

The Rho in DDL used for name of relation and in DML used for name of attributes.

         SQL                      Old name                   New name

Types of RENAME

Renaming can be used by three methods, which are as follows −

  • Changing name of the relation.

  • Changing name of the attribute.

  • Changing both.

raja
Published on 06-Jul-2021 14:18:13
Advertisements