Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
I am wanting to create a database to store my whole music collection using MySQL.
My music collection includes music on different mediums such as vinyl and CD.
The idea is to have a record of each item of music in the databse and generate a unique ID for each item and then put this ID onto a sticker which then goes onto the actual sleeve of the music item. Then the music item will go on to a shelve in the order of the unique ID in ascending order.
My initial idea was to have all of the music items in one table (i.e a mix of mediums).
However, if i do this then, for example the first 5 records in the database could be vinyl with unique IDs of 1,2,3,4 and 5. Then if I added say 3 CDs then these IDs would be 6,7 and 8. If i added another 3 vinyl at this point then the IDs of these would be 9, 10 and 11.
Now for the fussy bit. As i said, i want to be able to store these on a shelve, one shelve for vinyl and another for CDs.
My problem now is that when i put my vinyl on the shelve, putting them in order of their IDs in ascending order, it will appear like this:
1,2,3,4,5,9,10,11
As you can see, as they are all in the same table, the IDs of the vinyl on the shelve jump from 5 to 9.
I dont want this. I want it to be continuous so that they are easier to find.
I know this may seem to be really fussy, but that is the way i would like it to be.
My idea is to generate a unique ID for each music item depending on what medium the music is. For example if i added a CD and a vinyl to the database it would generate something like; CD102 FOR A CD and VNL201 for a vinyl.
Then if i was to add another CD and vinyl the IDs would be CD103 FOR A CD and VNL202 for vinyl.
I am not sure if this is actually possible but would like to at least find out.
I could do it using a table for each type of medium. But I would really like to keep all of the music items in the one table if i can.
Hope someone can help.
Thanks

Before you decide on using a single table, you should readup on "Database Normalization"

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |