Tuesday, 15 August 2017

project operation in relational algebra

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

STUDENT
Regno
Name
Age
Phone

BIT001
Ram
15
8652398452
BIT023
Selvi
17
7894562310
MIS089
Kumar
16
8562314701

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.
RESULT
Regno
Name
Age

BIT001
Ram
15
BIT023
Selvi
17
MIS089
Kumar
16
Example 2
RA: Π regno, name, ageage>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.
RESULT
Regno
Name
Age

BIT023
Selvi
17
MIS089
Kumar
16


*******************



1 comment:

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents