Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL database table design for black lists
    primarykey
    data
    text
    <p>I have a PHP application and I need to store black list data. My site members will add any user to his/her black list. So they won't see the texts of that users.</p> <p>Every user's black list is different.<br> A user can have 1000-1500 users in his/her black list.<br> User can add/remove anybody from his/her list.<br> Black list will have member's id and black listed people's ids. </p> <p>I'm trying to design database table for this. But I couldn't be sure about how can structure be ?<br> I have 7-8 MySQL tables but none of them is like this.</p> <p>Way 1:</p> <pre><code>--member ID-----black listed people (BLOB) ----------------------------------------- --1234----------(Some BLOB data)--------- --6789----------(Some BLOB data)--------- </code></pre> <p>I can serialize blacklisted people's IDs and save them inside a BLOB data column. When a user want to edit his/her list, I get BLOB data from table, remove unwanted ID and update column with new data. IT seems like a bit slow operation when a user has 1k-2k IDs.</p> <p>Way 2:</p> <pre><code>--member ID----black listed ID-------- -------------------------------------- --1234---------113434545-------------- --1234---------444445454-------------- --1234---------676767676-------------- --6789---------534543545-------------- --6789---------353453454-------------- </code></pre> <p>In this way, when a user wants to see his/her black list I give them all users in "black listed ID" column. When editing I add/remove new rows to table. This operation is fast but the table can be huge in time.</p> <p>Way 3:</p> <pre><code>--member ID----113434545----444445454----676767676---534543545-----353453454 ---------------------------------------------------------------------------- --1234--------yes------------yes------------yes------------no------no------- --6789--------no-------------no-------------no-------------yes------yes------ </code></pre> <p>Yes shows black listed, No shows not black listed. I create new column for each black listed person and update that column when a user adds a person or removes it.</p> <p>Way 4: </p> <p>???</p> <p>These are my ideas. I really appreciate if you can offer me a better one? Thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload