Page 33 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 33
Database Management Systems/Managing Database
Notes
Notes The select operator is commutative in nature i.e.,
. (R) ( (R))
cand A cand.B cand.B TcanA
Whereas the project operator is not commutative in nature.
. A ( (Relation)) (Relation) if and only if attributes list
attribute list attributelist.B listA
B is a subset of attribute list A.
The number of columns returned by the project operator is always equal to or less than the
number of columns in the original relation.
To manipulate the data stored in a table we can combine the two operators discussed so far.
Example: If we want to display the emp-id, emp-name, Birthdate, salary of all the
employees whose age is greater 30, we can write the expression as,
( (EMPLOYEE) )
eid, fname, Bdata, Salary, age age 30
This will return the following relation:
Projection 6
Eid Ename Bdate ($) Salary Age (years)
12345261 John 10-8-1965 25000 41
12345262 Jack 12-5-1955 55000 51
12345263 Green 20-11-1972 20000 34
12345265 Bill 25-4-1955 35000 51
12345266 Jill 04-4-1965 42000 41
Other examples are
OR DEPENDENT
Dep-Name, Sex, relationship 'Mother' relationship 'son'
DNo ( PROJECT)
PNo, PName, PLocation 'Detroit
( EMPLOYEE)
Ename, Eid, DNo, age, address (Salary 40000 AND Sex 'M')
Selection and projection operators are unary operators, they can be applied to only single
relation.
2.2.2 Set Operation of Relational Algebra
The different operators of relational algebra are as follows:
Union ( )
When applied on two relations, it returns all the rows which are either present in first relation
or second relation or in both the relations. It does not return the rows which has the same tuple
values - repeating rows. All the rows returned by this operator are unique. One of the constraints
26 LOVELY PROFESSIONAL UNIVERSITY