projection operation in relational algebra, unary operations in relational model, unary projection operation in relational algebra
PROJECT (Π) in Relational Algebra
Operation
|
PROJECT
|
||||||||||||||||||||||||||||||||
Type of operation
|
Unary
|
||||||||||||||||||||||||||||||||
Syntax
|
Π <attribute list> (R)
In the above expression,
<attribute list>
is list of attributes separated by comma. It can also be written as Π attr1, attr2, …, attrn (R).
|
||||||||||||||||||||||||||||||||
Function
|
Produces a new
relation with only some of the attributes of R as given in the attribute list,
and removes duplicate tuples (records).
It deals
with the structure of a relation (table).
In SQL,
the projection operation is specified in the SELECT clause of the query.
|
||||||||||||||||||||||||||||||||
Example 1
|
RA: Π regno, name, age (student)
SQL: SELECT
regno, name, dob FROM student;
Result:
Produces
a temporary relation with attributes regno, name and dob of student relation
with all records.
|
||||||||||||||||||||||||||||||||
Example 2
|
RA: Π regno,
name, age (σage>15^phone=9202092020 (student))
SQL: SELECT regno, name, age FROM student WHERE
age>15 and phone = 9202092020;
Result:
Produces
register number, name and age of all students whose age is greater than 15
and having phone 9202092020.
|
*******************
Go to Relational Algebra Operations page
d
ReplyDelete