Page 35 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 35
Database Management Systems/Managing Database
Notes If we apply intersection operator (n) on employee relation and projection 2 the resulting relation
will be similar to projection 2 relation as it has only two tuples in common.
Set-difference (Minus ‘–’)
This operator is also called “Minus” operator. If A and B are two relations and are union
compatible then (A - B) will return all the rows which are in A bit not in B. Consider, this
operator is applied to employee and projection 2 relations, then the resulting relation is,
EMPLOYEE Projection 2
Ename Eid Bdate Address Sex ($) Salary Dno Phone No. Age
(years)
Jack 12345262 12-5-1955 Chcago M 55000 7 773313218 51
John 12345261 10-8-1965 New M 25000 8 773213218 41
Jersey
Green 12345263 20- 11-1 972 New York M 20000 7 773421317 34
Brown 12345264 28-7-1968 Chicago M 40000 8 773210192 28
Jill 12345266 04-4-1965 New York F 42000 8 773291828 41
Donald 12345267 02-8-1968 Detroit M 20000 9 773423175 28
John 12375261 10-8-1965 New M 25000 9 773213218 41
Jersey
Cross Product (*)
This operator returns all the tuples of relation A plus all the tuples of relation B. Cross product
is denoted as, A * B - returns the Cartesian product of two relation. The resulting relation will be
much bigger in size than the two relations.
A B
Column 1 Column2 Column A Column 1 Column B
1 a a1 1 b1
2 b a2 2 b2
3 c a3 3 b3
A * B
Column 1 Column 2 Column A Column 1 Column B
1 a a1 1 b1
1 a a2 2 b2
1 a a3 3 b3
2 b a2 1 b1
2 b a2 2 b2
2 b a2 3 b3
3 c a3 1 B1
3 c a3 2 b2
3 c a3 3 b3
28 LOVELY PROFESSIONAL UNIVERSITY