Jump to content

Creating values for album_id field to link songs with albums


laanes

Recommended Posts

Hi!

 

I would like to create values for album_id field, so i can link songs with albums. Since there is a big number of songs and albums, I was wondering whether there is a better way to create those id's than going through each song manually?

 

Can you point me to the right direction or share any thoughts about this?

 

Greetings,

laanes

Link to comment
Share on other sites

Sorry for not being clear enough.

 

I would like the group the songs somehow for searching by album.

 

So i have created table albums with id, album_id, album.

 

Then i imported the albums from a textfile so that the id field got filled with auto incrementing numbers and albums field with album names.

 

album_id didn't exist in the textfile so it got filled with 0's.

 

I'd like for example song 1-9 to have album_id 1, song 10-19 to have album_id 2 etc.

 

How could i accomplish this?

 

 

Link to comment
Share on other sites

Auto-incrementing fields shouldn't be used for any other purpose than identification.

 

I'm wondering about album_id. If that's what you meant when you said

id is an

then my next question is "Why not sort on whatever thing you actually want to sort by? Like date or name or something."

Link to comment
Share on other sites

Hmm, yes, i can see what you mean.

 

But how would i get all the songs related to the album i searched for?

 

Since the AI id is unique to every row, it means i can not link songs to albums like this? :

 

"SELECT album, song FROM albums INNER JOIN songs ON albums.id = songs.id"

 

I'd like to get all songs from the album "raccoon" for example.

 

 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.