Presentation is loading. Please wait.

Presentation is loading. Please wait.

Presentation by: Tim Sablik.  There are two basic types of operations that will be addressed:  Unary operations are applied to only one relation. 

Similar presentations


Presentation on theme: "Presentation by: Tim Sablik.  There are two basic types of operations that will be addressed:  Unary operations are applied to only one relation. "— Presentation transcript:

1 Presentation by: Tim Sablik

2  There are two basic types of operations that will be addressed:  Unary operations are applied to only one relation.  Binary operations are applied to two relations.  I will define 9 operations in this presentation: insert, delete, update, select, project, join, union, intersection, and difference.

3  This is an example of the Insert operation.  Insert is a unary operation. It inserts a new tuple (row) into the relation.  Ex: CIS13, “Intro to Java” was inserted into this relation. No Course- Name UnitCIS15 Intro to C 5No Course- Name UnitCIS13 Intro to Java 5 CIS15 Intro to C 5

4 No Course- Name UnitCIS13 Intro to Java 5 CIS15 Intro to C 5 No Course- Name UnitCIS15 Intro to C 5  This is an example of the Delete operation.  Delete is a unary operation that removes a tuple from the relation.  Ex: CIS13 has been deleted.

5  This is an example of the Update operation.  Update is a unary operation that changes the value of some attributes of a tuple.  Ex: The number of units for CIS13 has been updated from 5 to 4. No Course- Name UnitCIS13 Intro to Java 5 CIS15 Intro to C 5No Course- Name UnitCIS13 Intro to Java 4 CIS15 Intro to C 5

6  This is an example of the Select operation.  Select is a unary operation that uses some criteria to select some of the tuples from one relation and create a new relation.  Ex: Only the courses with 5 units were selected. No Course- Name UnitCIS13 Intro to Java 5 CIS15 Intro to C 5 CIS19UNIX4 No Course- Name UnitCIS13 Intro to Java 5 CIS15 Intro to C 5

7  This is an example of the Project operation.  Project is a unary operation that is applied to one relation and creates a new relation. The new relation has fewer attributes (columns) than the original, but the same number of tuples.  Ex: The “Course-name” attribute has removed, and a new two-column relationship is projected. No Course- Name UnitCIS13 Intro to Java 5 CIS15 Intro to C 5 CIS19UNIX4 NoUnitCIS135 CIS155 CIS194

8  This is an example of the Join operation.  Join is binary operation that combines two relations based on common attributes.  Ex: The common attribute used to combine these two relations is the Course Number. They are Joined into a relation with 4 attributes: No, Course- Name, Unit, and Professor. No Course- Name UnitCIS13 Intro to Java 5 CIS15 Intro to C 5 CIS19UNIX4 NoProfessorCIS13Lee CIS15Walter CIS19Lu No Course- Name UnitProfessorCIS13 Intro to Java 5Lee CIS15 Intro to C 5Walter CIS19UNIX4Lu

9  This is an example of the Union operation.  Union is a binary operation that takes two relations with the same attributes an makes a new relation in which each tuple is either in the first, second, or both relations.  Ex: The Union of two relations creates one relation with all the tuples, but no duplicates (John and George only appear once). Student ID F-NameL-Name6754JohnBrown 5690GeorgeWhite 6580AnneSmith F-NameL-Name6754JohnBrown 5690GeorgeWhite 6733BobThompson F-NameL-Name6754JohnBrown 5690GeorgeWhite 6580AnneSmith 6733BobThompson

10  This is an example of the Intersection operation.  Intersection is a binary operation that takes two relations that have the same attributes and combines them into one relation. However, only tuples that are in both relations are present in the new relation.  Ex: John and George are in both original relations, so they are the only ones in the Intersection relation. Student ID F-NameL-Name6754JohnBrown 5690GeorgeWhite 6580AnneSmith F-NameL-Name6754JohnBrown 5690GeorgeWhite 6733BobThompson F-NameL-Name6754JohnBrown 5690GeorgeWhite

11  This is an example of the Difference operation.  Difference is a binary operation that is applied to two relations with the same attributes. It outputs a new relation with tuples that are in the first relation but not in the second.  Ex: Anne is the only tuple in the first relation that is not in the second relation, therefore she is the only tuple in the new relation. Student ID F-NameL-Name6754JohnBrown 5690GeorgeWhite 6733BobThompson F-NameL-Name6754JohnBrown 5690GeorgeWhite 6580AnneSmith F-NameL-Name6580AnneSmith


Download ppt "Presentation by: Tim Sablik.  There are two basic types of operations that will be addressed:  Unary operations are applied to only one relation. "

Similar presentations


Ads by Google