Jump to content

setting up a table


harkly

Recommended Posts

Looking for suggestions on the best way to set up a table in MySQL. I am looking for speed & efficency.

 

I can either set it up 2 ways

 

#1

ID  |  userID1  |  userID2
1   |  joe      |  jane
3   |  joe      |  dylan
4   |  jane     |  joe

 

or

 

#2

userID1  |  grant1  |  grant2  | grant3 | ... and so on for 25 grants
joe      |  jane    |  dylan
jane     |  joe

 

What this table is doing is granting rights to another user based on userID1, if the second user is not listed in the table

then they are unable to contact userID1.

 

 

I can see a few issues with both.

#1 is going to have the same userID multiple times and will take time to be searched and compared

#2 is going to have empty space and be limited in the number of users who can contact userID1

 

 

So say there are 1000 different users and they all have granted access to 10 different people, which one would

be faster in searching? Or perhaps there is a better way to set it up?

 

I am pretty new to setting up databases so any help would be appreciated! Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/222996-setting-up-a-table/
Share on other sites

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.