Figure 3-23: Band names, tracks, and silly (Web site translator) descriptions.

Figure 3-23: Band names, tracks, and silly descriptions. How It Works You are asked for two tables from three fields. One table has one field and the other table has two fields. The three fields are conveniently arranged. Look for a one-to-many relationship by finding duplicated values. The data is inconveniently and deliberately unsorted. 1. The first column contains the names of numerous different bands (musical groups) and the second column a track or song name. Typically, different bands or musical groups create many tracks. A one-to-many relationship exists between the band names and track names. 2. Band names in the first column are duplicated. Track names and descriptions are not. This supports the solution already derived in step 1. 3. Band names are the only duplicated values, so they make up the table on the parent side of the one-to-many relationship. The other two columns make up the table on the child side of the relationship. 4. The track name must identify the track uniquely. The description is just silly. Figure 3-24 shows three viable solutions with Option 3 being the better of all of the three options because surrogate keys are used for the primary and foreign keys. Option 2 is better than Option 1 because in Option 2 the one-to-many relationship is a non-identifying relationship, where the primary key on the TRACK table is not composite key. Nirvana Nirvana Nirvana Nirvana Stone Temple Pilots Greetings From Limbo Greetings From Limbo Pearl Jam Pearl Jam Pearl Jam Foo Fighters Greetings From Limbo Red Hot Chili Peppers Red Hot Chili Peppers Red Hot Chili Peppers Red Hot Chili Peppers Soundgarden Red Hot Chili Peppers Red Hot Chili Peppers Come As You Are About A Girl The Man Who Sold The World Polly The Right Line Greetings From Limbo Fatal Immortality Around The Bend Ashes My Friends Suck My Kiss University Speaking Under The Bridge Otherside Californication Bass reverb Lots of lovely bass Sell out! Who s that? Country groove The Wizard of Oz Deadly Just imagine Nuts! Heavy Hmmm No thanks OK Where s that confounded bridge? Hmmm again Hot and dry BAND NAME TRACK DESCRIPTION 62 Chapter 3
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Leave a Reply