Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

MS-Access: How to Create a CD Database


  • Please log in to reply
1 reply to this topic

#1 LittleGreenDots

LittleGreenDots

  • Members
  • 444 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Metro Detroit Area
  • Local time:05:23 PM

Posted 14 August 2010 - 08:49 AM

I want to make a database listing CDs and track titles. I can't figure out how to go about this, since the number of tracks vary so widely on different CDs. Some CDs have 23 tracks! Do I need to create 23 fields just for those few?

Better yet, can I make an expandable field that will keep creating new data fields as needed?

I know how to set up a basic database, so I don't need help with that.

Thanks.

BC AdBot (Login to Remove)

 


#2 TimYH

TimYH

  • Members
  • 47 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:NY / NJ
  • Local time:05:23 PM

Posted 15 August 2010 - 06:45 PM

The idea that you propose in having a single table that lists the CD Name (Album Name) and the tracks together as a single line item isn't a very effective method of making that database for exactly the reasons you raised. Rather than having them in one table, split them up and relate them.

The way I would go about doing this is...

Table 1: Albums
Fields: Album Name, Artist, Year, Genre, Whatever other fields you might add
Primary Key: Either make it a composite key with Album Name and Artist or create an additional field which contains a unique identifier such as a Number. I would suggest creating a unique field as the primary key as it is easier to work with.

Table 2: Tracks
Fields: Song Title, Artist, Album, Track Number
Primary Key: I would go with Song Title and Artist as a composite Primary Key.

Table 3: Artists (If you so choose)
Fields: Artist, any other info about the artist or group you wish to include.
Primary Key: Artist Name

The important thing is the relationships between these three tables.

Albums Table is related to Tracks Table in a One to Many Relationship (One album has Many songs).

Albums Table is also related to the Artist Table in a One to Many Relationship as well (One Artist may have Many Albums).

You need to determine what you want to have as your primary keys which will determine what the foreign keys will be in the related tables. For example, if in the Albums Table you use the Name and Artist as the Primary Key, then these fields would be related to the corresponding fields in the Tracks Table.

You don't have to follow my model exactly, but do you understand the idea of splitting up the Tracks and Album Names fields into different tables and relating them? This eliminates the problem of constantly having to add fields for new tracks. It'll also make queries significantly easier to sculpt.

Hope this helps
I like to think I know a bit about computers, I apologize if my advice is not sound or clear. I try my best to give good answers.

Line of Defense
aVast! | Comodo | Malwarebytes




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users