# Rename (relational algebra)

{{ safesubst:#invoke:Unsubst||$N=Unreferenced |date=__DATE__ |$B= {{#invoke:Message box|ambox}} }} In relational algebra, a rename is a unary operation written as ${\displaystyle \rho _{a/b}(R)}$ where:

The result is identical to ${\displaystyle R}$ except that the ${\displaystyle b}$ attribute in all tuples is renamed to ${\displaystyle a}$. For an example, consider the following invocation of ${\displaystyle \rho }$ on an ${\displaystyle Employee}$ relation and the result of that invocation:

${\displaystyle Employee}$ ${\displaystyle \rho _{EmployeeName/Name}(Employee)}$
Name EmployeeId
Harry 3415
Sally 2241
EmployeeName EmployeeId
Harry 3415
Sally 2241

Formally the semantics of the rename operator is defined as follows:

${\displaystyle \rho _{a/b}(R)=\{\ t[a/b]:t\in R\ \}}$

where ${\displaystyle t[a/b]}$ is defined as the tuple ${\displaystyle t}$ with the ${\displaystyle b}$ attribute renamed to ${\displaystyle a}$ so that:

${\displaystyle t[a/b]=\{\ (c,v)\ |\ (c,v)\in t,\ c\neq b\ \}\cup \{\ (a,\ t(b))\ \}}$