Download presentation

Presentation is loading. Please wait.

Published byBerenice Janney Modified over 2 years ago

1
8.2 n-ary Relations and their applications

2
Def– n-ary Let A1, A2, …An be sets. An n-ary relation on these sets is a subset of A1xA2xA3…xAn. The sets A1, A2, …An are called domains of the relation and n its degree

3
Database Database: Consists of records, n-tuples, made up of fields. The fields are the entries of the n-tuple.

4
Example NameID#MajorFavorite dessert Anne12457MathChocolate bar Bill34521CSIce cream Cindy46891CSChocolate bar Dave48320MathCookies Ellen34901CSyogurt

5
Example NameID#MajorFavorite dessert Anne12457MathChocolate bar Bill34521CSIce cream Cindy46891CSChocolate bar Dave48320MathCookies Ellen34901CSyogurt Notice the repeats. Questions: Can we identify each table by major? __By name? __ ID#- primary key (a domain that determines the n tyuple) Major- not primary Favorite dessert- not primary Major and dessert could serve as a composite key (combination that determines the n-tuple)

6
Projections P14 maps (a1,a2,a3,a4) to (a1,a4) NameID#MajorFavorite dessert Anne12457MathChocolate bar Bill34521CSIce cream Cindy46891CSChocolate bar Dave48320MathCookies Ellen34901CSyogurt NameFavorite dessert AnneChocolate bar BillIce cream CindyChocolate bar DaveCookies Ellenyogurt

7
Join Join operation: J p combines two relations R1 and R2 into a new one by combining all m-tuples of R1 with all n- tuples of R2, where the last p components of R1 agree with the first p components of R2.

8
Use the Join operator J2 NameID#Major Anne12457Math Bill34521CS Cindy46891CS Dave48320Math Ellen34901CS Fred38888Undecided ID#MajorGPAApptTime 12457Math3.9Wed11am 34521CS3.7Tues10am 46891CS3.3Wed1pm 48320Math3.6Mon2pm 34901CS3.5Fri11am

9
J2 result NameID#MajorGPAApptTime Anne12457Math3.9Wed11am Bill34521CS3.7Tues10am Cindy46891CS3.3Wed1pm Dave48320Math3.6Mon2pm Ellen34901CS3.5Fri11am

Similar presentations

OK

Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.

Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on history of atom structure Ppt on fact and opinion Ppt on uses of synthetic fibres Ppt on area of plane figures worksheets Ppt on action research in education Ppt on swami vivekananda life Ppt on 7 wonders of the modern world Ppt on staff motivation Ppt on infrared remote control Ppt on cash flow statement analysis