1 / 11

Presentation by: Tim Sablik

Database Operations on Relations. Presentation by: Tim Sablik. 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.

maggy-howe
Download Presentation

Presentation by: Tim Sablik

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database Operations on Relations 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. Types of Operations

  3. Insert • 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.

  4. Delete • 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. Update • 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.

  6. Select • 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.

  7. Project • 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.

  8. Join • 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.

  9. Union • 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).

  10. Intersection • 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.

  11. Difference • 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.

More Related