PROJECT Operation in Relational Algebra

22 May, 2020
Prerequisite – Relational AlgebraProject operation selects (or chooses) certain attributes discarding other attributes. The Project operation is also known as vertical partitioning since it partitions the relation or table vertically discarding other columns or attributes.
Notation:
πA(R)
where ‘A’ is the attribute list, it is the desired set of attributes from the attributes of relation(R),symbol ‘π(pi)’  is used to denote the Project operator,R is generally a relational algebra expression, which results in a relation.
Example –
πAge(Student)
πDept, Sex(Emp)
Example –Given a relation Faculty (Class, Dept, Position) with the following tuples:
1. Project Class and Dept from Faculty –
πClass, Dept(Faculty)
Here, we can observe that the degree (number of attributes) of resulting relation is 2, whereas the degree of Faculty relation is 3, So from this we can conclude that we may get a relation with varying degree on applying Project operation on a relation.
Hence, the degree of resulting relation is equal to the number of attribute in the attribute list ‘A’.
2. Project Position from Faculty –
πPosition(Faculty)
3. Project Class from Faculty –
πClass(Faculty)
Important points:
The Project operation removes duplicate tuples.The Project operation is not commutative, that is :πAttribute List 1(πAttribute List2(R)) != πAttribute List 2 (πAttribute List1(R))The following expression is valid only if Attribute List 1 is a subset of Attribute List 2. πAttribute List 1(πAttribute List2(R))Moreover, writing the above expression is as good as writing the expression below:πAttribute List 1(πAttribute List2(R)) = πAttribute List 1 (R)The cardinality (number of tuples)  of resulting relation from a Project operation is:1 <= πA(R) <= |R|The degree (number of attributes) of resulting relation from a Project operation is equal to the number of attribute in the attribute list ‘A’.In SQL, SELECT DISTINCT query is exactly as same as PROJECT here.
The Project operation removes duplicate tuples.
The Project operation is not commutative, that is :πAttribute List 1(πAttribute List2(R)) != πAttribute List 2 (πAttribute List1(R))
πAttribute List 1(πAttribute List2(R)) != πAttribute List 2 (πAttribute List1(R))
The following expression is valid only if Attribute List 1 is a subset of Attribute List 2. πAttribute List 1(πAttribute List2(R))Moreover, writing the above expression is as good as writing the expression below:πAttribute List 1(πAttribute List2(R)) = πAttribute List 1 (R)
πAttribute List 1(πAttribute List2(R))
Moreover, writing the above expression is as good as writing the expression below:
πAttribute List 1(πAttribute List2(R)) = πAttribute List 1 (R)
The cardinality (number of tuples)  of resulting relation from a Project operation is:1 <= πA(R) <= |R|
1 <= πA(R) <= |R|
The degree (number of attributes) of resulting relation from a Project operation is equal to the number of attribute in the attribute list ‘A’.
In SQL, SELECT DISTINCT query is exactly as same as PROJECT here.
DBMS
GATE CS
Write From Home
DBMS
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
CTE in SQL
Difference between Clustered and Non-clustered index
Introduction of DBMS (Database Management System) | Set 1
Introduction of B-Tree
SQL Trigger | Student Database
Layers of OSI Model
Types of Operating Systems
TCP/IP Model
Page Replacement Algorithms in Operating Systems
Inter Process Communication (IPC)