user1092042
user1092042

Reputation: 1295

Relational database in phpmyadmin

I have two tables set up in phpmyadmin- table userid and table data. The userid table has a single column userid which is the primary key. The table data has id|name|src| and a bunch of other information. The issue right now is that the column id which is a 16 character long string acts as a primary key in table userid and foreign key in table data. Now if the same user wants to upload more than one image then i am having to repeat the id in the table data and the table is becoming very large. Is there any other way to go about this(i am relatively new so im sorry if this sound rather stupid.). Finally is there actually any performance boost in this situation by indexing the id of the user in the other table as to me it seems like just a waste of space as im haveing to repeat the user id one more time in the table userid as compared to having a single table to hold both data and user id.

Upvotes: 1

Views: 1178

Answers (2)

Kishor Kundan
Kishor Kundan

Reputation: 3165

This is the case with One to Many Relations. I don't think that the table will grow that large to give you issues. This would be the way to go.

Alternatively, a strategy used by many cms and platforms to store settings. You can store JSON object having src of image into the image column. But this will add the overhead of updating image information every time a image created and deleted.

Upvotes: 1

Matthew Perrott
Matthew Perrott

Reputation: 309

Short answer: No. You will have to repeat the userid otherwise you won't know who it belongs to.

Upvotes: 1

Related Questions