Monday, July 19, 2010

Unit 9 DB

Unit 9 Blog Databases

I found the concept of cardinality difficult and I'm not sure that I understand it well enough to create a simple ERD. However, it seems from a scan of the literature as represented in this week's readings that cardinality relates to the minimum and maximum instances of an Entity that can be associated with another Entity. For example one invoice can list many items but each invoice can have only one customer. A customer may have many invoices but only one customer billing address.

Entity relationships seem to break down when there is a many to many relationship. The example we encountered in the readings involved a Student Entity and a Class Entity. There are many students and each student may be taking more than one class. Each Class Entity has many students. So with that a many to many relationship develops. This condition or relationship will cause problems for the database. Apparently the solution is to construct a bridge table entitled Student/Class with a concatenated primary key joining the Student PK and the Class PK.

I found the same problem when developing my Artists, Works, Museums database. The simple solution would have been to say each artist may create or or more works of art and each work can have one and only one artist. Thus preserving a one to many relationship between the Artist and Works tables. But with collaboration such a large part of the the digital world this is really not now if it ever was a useful or sustainable perspective.

Since one artist may create many works and each work may be the result of one or more artists the problematic many to many relationship arises. To solve this problem, I inserted a bridge table between the Artist Table and the Work Table entitled Artist/Work Table with the primary key being a concatenation of the Artist ID and the Work ID. In this bridge table , I added columns for the the Artist ID and Work ID so that both became non-key attributes. This restored a one to many relationship between the Artist Table and the Artist/Work Table as one artist may have many works in which she collaborated, but that part of the collaboration by a particular artist relates back to that one artist. Also each work may be the collaborative result of one or more artists but that particular instance of collaboration relates to one and only one work. A one to many relationship also exists between the Artist/Work Table and the Work Table.

At least I think...

No comments:

Post a Comment