Rename (relational algebra)
Encyclopedia
In relational algebra
Relational algebra
Relational algebra, an offshoot of first-order logic , deals with a set of finitary relations that is closed under certain operators. These operators operate on one or more relations to yield a relation...

, a rename is a unary operation
Unary operation
In mathematics, a unary operation is an operation with only one operand, i.e. a single input. Specifically, it is a functionf:\ A\to Awhere A is a set. In this case f is called a unary operation on A....

 written as where:
  • and are attribute
    Property
    Property is any physical or intangible entity that is owned by a person or jointly by a group of people or a legal entity like a corporation...

     names
  • is a relation
    Relation (mathematics)
    In set theory and logic, a relation is a property that assigns truth values to k-tuples of individuals. Typically, the property describes a possible connection between the components of a k-tuple...



The result is identical to except that the field in all tuple
Tuple
In mathematics and computer science, a tuple is an ordered list of elements. In set theory, an n-tuple is a sequence of n elements, where n is a positive integer. There is also one 0-tuple, an empty sequence. An n-tuple is defined inductively using the construction of an ordered pair...

s is renamed to an field. For an example, consider the following relation and its renamed version:
|-
!
!
|- style="vertical-align: top"
|
{| align="center" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse; border: 1px solid black"
|- style="background-color: silver; text-align: left"
! style="border: 1px solid black" | Name
! style="border: 1px solid black" | EmployeeId
|-
| style="border: 1px solid black" | Harry
| style="border: 1px solid black" | 3415
|-
| style="border: 1px solid black" | Sally
| style="border: 1px solid black" | 2241
|}
|
{| align="center" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse; border: 1px solid black"
|- style="background-color: silver; text-align: left"
! style="border: 1px solid black" | EmployeeName
! style="border: 1px solid black" | EmployeeId
|-
| style="border: 1px solid black" | Harry
| style="border: 1px solid black" | 3415
|-
| style="border: 1px solid black" | Sally
| style="border: 1px solid black" | 2241
|}>


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


where is defined as the tuple with the attribute renamed to so that:


The result of the rename is only defined when the attribute did not appear already in the
header
Header
Header may refer to: Computers and engineering* Header , supplemental data at the beginning of a data block** E-mail header** HTTP header* Header file, a text file used in computer programming...

of the operand.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK