You are on page 1of 4

Relational Algebra by JK Sir Axixa Technologies

Relational Algebra in DBMS


Relational Algebra In DBMS- Relational Algebra operations का एक समूह होता हैं जिसका प्रयोग
relation से data को manipulate करने के जिया जकया िाता हैं
Relational algebra एक procedural language हैं इसमें operator का प्रयोग queries को perform करने
के जिए िाता हैं और यह DBMS में प्रयुक्त होने वािी intermediate language हैं

Relational Algebra Operations in DBMS


1. Select Operation (σ)
2. Project Operation (∏)
3. Union Operation (∪)
4. Set Difference (−)
5. Cartesian Product (Χ)
6. Intersection ( ∩ )

1. Select Operation (σ)


Select operation को sigma symbol ( σ ) द्वारा दर्ाा या िाता हैं , इस operator का use tuples को
select करने के जिए जकया िाता हैं िो की दी हुई condition को satisfy करे
यह operation एक unary operation हैं िो जसर्ा एक ही relation या table में define होता हैं

Example 1
σ topic = "Database" (Student)
Output – Selects tuples from Student where topic = ‘Database’.
Example 2
σ topic = "Database" and author = "csestudies "( Student)
Output – Selects tuples from Student where the topic is ‘Database’ and ‘author’ is csestudies.
Example 3
σ sales > 50000 (Customers)
Output – Selects tuples from Customers where sales is greater than 50000

2. Project Operation (∏)


project operation को (∏) pi symbol द्वारा दर्ाा या िाता हैं , यह भी एक unary operation हैं अर्ाा त
इसमें जसर्ा एक relation होता हैं
project operation का use एक relation में से attribute के subset को select करने के जिए जकया िाता
हैं और जिन attribute को select नहीींजकया िाता हैं उन्हें eliminate कर जदया िाता हैं या उन्हें हटा जदया
िाता हैं

CustomerID CustomerName Status


Relational Algebra by JK Sir Axixa Technologies

1 राहुि Active
2 राम Active
3 श्याम Inactive
4 साहूिी Active

Here, the projection of CustomerName and status will give

Π CustomerName, Status (Customers)

CustomerName Status
राहुि Active
राम Active
श्याम Inactive
साहूिी Active

3. Union Operation (∪)


 Union Operation को हम (∪) symbol द्वारा दर्ाा या िाता हैं
R= P∪Q

िहााँ P and Q दो input relation हैं और R output relation हैं

 Union Operation में दो input relation होते हैं िो की union compatible हो


 इस operations का output relation उन tuples (ROW ) को contain करती हैं िो Relation 1
and Relation 2 में हो
 और िो duplicate tuples होते हैं उन्हें destroy या eliminate कर जदया िाता हैं

Example:-

Table A Table B
column column column column
1 2 1 2
1 1 1 1
1 2 1 3
Relational Algebra by JK Sir Axixa Technologies

A ∪ B gives

Table A ∪ B
column 1 column 2
1 1
1 2
1 3

4. Set Difference (−)


Difference operations को (−) symbol द्वारा दर्ाा या िाता हैं

Syntax:-
R=P–Q

Difference operation, Relation 1 में स्थर्त common tuples को हटा दे ता हैं तर्ा िो हमारा
output आयेग वह Relation 1 में स्थर्त tuples होींगे िो की Relation 2 में ना हो

Example:-
Table A Table B
column 1 column 2 column 1 column 2
1 1 1 1
1 2 1 3

C=A–B

Table A – B
column 1 column 2
1 2

5. Cartesian Product (Χ)


 इस operation को X Symbol द्वारा दर्ाा या िाता हैं
Syntax: - R = PXQ
Relational Algebra by JK Sir Axixa Technologies

 इस operator का use दो जवजभन्न relation की information को एक relation में include करने के


जिए जकया िाता हैं

6. Intersections (∩)

 intersection operation को ∩ symbol द्वारा दर्ाा या िाता हैं


 इस operator का प्रयोग दो relation में से common tuples को select करने के जिए जकया िाता हैं
Syntax:- A ∩ B

Example:-
Table A Table B
column 1 column 2 column 1 column 2
1 1 1 1
1 2 1 3

Table A ∩ B

column 1 column 2

1 1

You might also like