MySQL Forums
Forum List  »  Newbie

Re: Counting and Sorting data from a table
Posted by: Preston McMurry
Date: April 04, 2005 03:48PM

Basically, any field in a table which requires that the field (not its data) be repeated is a candidate for a one-to-many relationship.

Album
pk: album_id
other fields

Track
pk: track_id
fk: album_id

Since an album cannot exist without tracks, it must have one track, but its maximum is unlimited.

Album --1-----------1:M -- Track

The problem with your current design is that you are wasting space if there are fewer than 10 (or whatever) tracks, and you are likewise limited by the maximum number of tracks your listed CDs could hold.

http://prestonm.com ... http://www.mcmurry.com

Options: ReplyQuote


Subject
Written By
Posted
Re: Counting and Sorting data from a table
April 04, 2005 03:48PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.