mercredi 4 mars 2015

How to design my MySQL database? One or two tables?


Vote count:

0




I need an advice from you.


I have users on my website who are allowed to upload 10 pictures. I want to give the users the opportunity to 1. order the pictures 2. give the pictures a title.


How should the database design look like?


I already have a table 'image_order' with the columns user_id first ... tenth


The values there are NULL or the image name. So the order works fine.


But now there is this second opportunity I want my users to give: a title.


I could easily crerate a new table 'image_titles' with the columns user_id image_name image_title


where user_id + image_name are the primary key.


But I don't know, if this is a good design. I also could delete the table 'image_order' and add column to my table 'image_titles' which could be named 'order_position'. So that there would be just one table 'image_titles' or maybe better 'image_properties' with the following columns: user_id image_name image_title order_position


where user_id + image_name are the primary key.


What do you advise? One or two tables? Or do you have another idea?


[It is about performance. There could be a lot of users and a lot of pictures...]



asked 14 secs ago







How to design my MySQL database? One or two tables?

Aucun commentaire:

Enregistrer un commentaire