Need help in table design...

Hi there,
I am developing a database for photo gallery and need your help into that. As of now I am storing all images against the album name in my database with some separator. I am able to get and push data perfectly but what is disturbing is that I am not sure if I am using the database in the approved manner. It will be a gr8 favor to me if someone can tell me how to design the following table in a better way.

UId albumName imgName
1 album one a.jpg/b.jpg/c.jpg/…nth.jpg
1 album two one.jpg/two.jpg/…nth.jpg
2 ----------- --------------------------------------
Why i am hesitating in going with the same structure of the table is becasue if someone wants to delete only 1 picture out of his collection it will be a trickky part of maniputaing strings.

Hope that i have mentioned everything needed. Please let me know if you need any other input from me in resolving my issue.

Thnx.
Jatin

What u wanne do is called normalizing ur Table.

in this case it quite easy:

u have to use 2 tables, one for the albums and one for the pictures:

albumID UId albumName
1 1 album one
2 1 album two

imgID albumID imgName
1 1 a.jpg
2 1 b.jpg
3 1 c.jpg
4 2 one.jpg
5 2 two.jpg

thats all. of cause u may use more field in ur img-table like size or date.

thnx for this kind help. hope it will help :)

Sponsor our Newsletter | Privacy Policy | Terms of Service