What is the rename operator in DBMS?

Rename operator

The rename operator ρ\rho is one of the unary operators in relational algebra and is used to rename relations in a DBMS. In other words, some relations or attributes may have complex names and can be changed to make writing queries easier.

This relational operator is a base for SQL (Structured Query Language) and is used to rename relations.

Syntax

A rename query looks like the following:

The new_relation_namenew \_ relation \_ name contains the name we want to replace with the original relation RR and the new_attribute_name_listnew \_ attribute\_ name\_ list contains the changed attribute names of RR.

Why is it needed?

The following are some reasons to use the rename operator:

  • It helps us have user-friendly names so that it is easy to understand.

  • We can easily write queries without using complex names.

  • We may want to save the result of a RA expression in the form of a relation.

  • It removes the confusion of attributes having the same names.

  • It works really well to distinguish relations/tables that are joined with themselves.

Types

Three following types of renaming can be done:

  • Renaming a relation

  • Renaming an attribute

  • Renaming both

Let's look at the differences between them using examples:

Rename a relation

Suppose we have a relation named StudentsStudents and we want to change it to FinalYrStudentsFinalYrStudents, the rename operation works as follows:

Rename an attribute

Suppose we have a relation named Students and we want to change its attributes StudentIDStudentID, StudentNameStudentName to SIDSID and SNameSName, the rename operation works as follows:

The attributes will be ordered as same as the tables and must be renamed in the same order. If only selective attributes are to be changed, rewrite the original attribute names of those that are supposed to be unchanged.

Rename both

Next, we'll change both the relation name and attributes of the StudentsStudents class:

Conclusion

Once relations and attributes are renamed, they can be used in the projection and selection operations to access the relations.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved