Answer the question
In order to leave comments, you need to log in
What is the best way to store in a database?
Small numbers:
1000 - users.
100 - tasks.
What is it?
On the site, when performing a task, you need to enter into the database : a unit in the column with the task number and a row with the id of the user, roughly put a flag that the task has been completed by this user.
Question:
How to store all these values more rationally? Obviously my way is the most oaky, create a table and that's it. I thought to create an array and where the enumeration goes: 001010001010, the job number, this is index-1 (from zero, the search starts if), but I thought, what if tasks are added, and they will be added, there you already need to think about how to do it, can be done with a margin.
Answer the question
In order to leave comments, you need to log in
Usually separate tables are created: in your case, users, tasks, and tasks performed by users. The last table has columns with the user id (indexed for quick select) and the id of the completed task. In the query, you connect all this using JOIN. Recommended reading:
zlob.in/2013/01/struktura-tablic-dlya-kataloga-tov... (EAV storage structure model);
www.anton-pribora.ru/articles/mysql/mysql-join
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question