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

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?

 

 

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."

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.

 

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.