Rename (relational algebra)

In relational algebra, a rename is a unary operation written as \rho_{a/b}(R) where:

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

Employee \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:

\rho_{a/b}(R) = \{ \ t[a/b] : t \in R \ \}

where t[a/b] is defined as the tuple t with the b attribute renamed to a so that:

t[a/b] = \{ \ (c, v) \ | \ ( c, v ) \in t, \ c \ne b \ \} \cup \{ \ (a, \ t(b) ) \ \}
This article is issued from Wikipedia - version of the Monday, January 06, 2014. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.