| Home | Sign up! | Projects | Seminars | Research Notes | Today's Lecture | About |

Update Research Note Form
 Course: Research Note Topic: Research Note Description: The 8 operators for Coddâ€™s relational algebra are :
• Restriction
• Projection
• Product
• Union
• Intersection
• Difference
• Join
• Division

Defination and examples of the 8 operators :

TABLE1 :SUPPLIERS
S SName Status City
S1 Smith 20 London
S2 Jones 10 Paris
S3 Blake 30 Paris
S4 Clark 20 London
TABLE2 :PARTS
P PName Color Weight City
P1 Nut Red 12 London
P2 Bolt Green 17 Paris
P3 Screw Blue 17 Rome
P4 Screw Red 14 London
P5 Cam Blue 12 Paris
P6 Cog Red 19 London
TABLE3 :SHIPMENTS
S P Quantity
S4 P2 200
S3 P2 200
S2 P2 400
S2 P1 300
S1 P6 100
S1 P4 200
S1 P3 400
S4 P5 400
S4 P4 300
S1 P2 200
S1 P1 300
1. Restriction : Returns a table containing all records from a specified table that satisfy a specific condition.
Query : select * from shipments where Quantity<150;

2. Projection : Returns a table containing all (sub) records that remain in a specified fields have been removed.
Query : select S, City from suppliers;

3. Product : Returns a table containing all possible records that are a combination of two records, one from each of two specified tables.
Query : select * from suppliers, parts where suppliers.S = "S1" and parts.P = "P1";

4. Union : Returns a table containing all records that appear in either or both of two specified tables.
Query : select * from suppliers, parts where suppliers.S = parts.P union select *from suppliers, parts where suppliers.S<>parts.P;

5. Intersection : Returns a table containing all records that appear in both of two specified tables.
Query : select * from suppliers, parts where suppliers.S = parts.P;

6. Difference : Returns a table containing all records that appear in both of two specified tables.
Query : still searching .

7. Join : Returns a table containing all possible records that are a combination of two records one from each of two specified tables, such that the two records contributing to any given combination have a common value for the common fields of the two tables (and that common value appears just once, not twice in the resulting record).
Query : select suppliers.S, SName, Status, City, P, Quantity from suppliers, shipments where suppliers.S = shipments.S;

8. Division : Takes two single-field tables and one double-field table and returns a table containing all records from one single-field table that appear in the double-field table matched with all records in the other single-field table.
Query : still searching .