Overview Relational Algebra Traditional Set Operation Union Intersection
Overview • ���������� (Relational Algebra) – Traditional Set Operation ��� Union, Intersection, Difference, ��� Cartesian Product – Special Relational Operation ��� Select, Project, Join ��� Divide – ��������� Relational Algebra ��� Rename, Extend, Summarize, Insert, Update ��� Delete 2
Relational Algebra Operations 5
Relational Algebra Operations 6
Example 1 - Cartesian product 8
Example 2 - Cartesian product • List the names and comments of all clients who have viewed a property for rent. ( client. No, client. Name(CLIENT)) × ( client. No, property. No, comment (VIEWING)) × 9
Result - Cartesian product 10
Example - Union 12
Example - Intersection 14
Example - Difference 16
Example - Select (or Restrict) R WHERE Age = 20 R WHERE Sex = 20 19
Example - Project 21
Example - Divide R 3 28
��������� Relational Algebra • �������������� Relational Algebra ������������� – RENAME – EXTEND – SUMMARIZE – INSERT – UPDATE – DELETE 29
Rename • �������������� Attribute • ����� R RENAME old-attribute AS newattribute • ������ – R ��� Relation ������� Attribute – old-attribute ������� Attribute – new-attribute ������� Attribute • ���� S RENAME CITY AS SCITY 30
- Slides: 35