The RENAME operation is used to rename the output of a relation.
Sometimes it is simple and suitable to break a complicated sequence of operations and rename it as a relation with different names. Reasons to rename a relation can be many, like –
- We may want to save the result of a relational algebra expression as a relation so that we can use it later.
- We may want to join a relation with itself, in that case, it becomes too confusing to specify which one of the tables we are talking about, in that case, we rename one of the tables and perform join operations on them.
ρ X (R)
where the symbol ‘ρ’ is used to denote the RENAME operator and R is the result of the sequence of operation or expression which is saved with the name X.
- Example-1: Query to rename the relation Student as Male Student and the attributes of Student – RollNo, SName as (Sno, Name).
ρ MaleStudent(Sno, Name) πRollNo, SName(σCondition(Student))
- Example-2: Query to rename the attributes Name, Age of table Department to A,B.
ρ (A, B) (Department)
- Example-3: Query to rename the table name Project to Pro and its attributes to P, Q, R.
ρ Pro(P, Q, R) (Project)
- Example-4: Query to rename the first attribute of the table Student with attributes A, B, C to P.
ρ (P, B, C) (Student)
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Relational Algebra and Relational Calculus
- PROJECT Operation in Relational Algebra
- SELECT Operation in Relational Algebra
- Cartesian Product Operation in Relational Algebra
- Difference between Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC)
- Introduction of Relational Algebra in DBMS
- Extended Operators in Relational Algebra
- Basic Operators in Relational Algebra
- How to solve Relational Algebra problems for GATE
- Query Optimization in Relational Algebra
- Set Theory Operations in Relational Algebra
- Types of Keys in Relational Model (Candidate, Super, Primary, Alternate and Foreign)
- Relational Model in DBMS
- Mapping from ER Model to Relational Model
- Introduction of Relational Model and Codd Rules in DBMS
- Anomalies in Relational Model
- Tuple Relational Calculus (TRC) in DBMS
- Domain Relational Calculus in DBMS
- Properties of Relational Decomposition
- Violation of constraints in relational database
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : adarshpro43