M
M
Matthew Stafford2017-07-25 14:41:03
PHP
Matthew Stafford, 2017-07-25 14:41:03

Create a separate table for each user. Is it right?

Hello! I would like to ask if it is worth making a separate table for each user, is this method convenient and how to implement it in general?
In the table itself, store all the data about the user's account and all his actions, for example, comments, posts.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
Yuri Esin, 2017-07-25
@Exomode

I will try to convey the essence of relational language in a folk language. Each table must represent some kind of data model. Each record is an object, each column is its property of a certain type. A user is one model and there can be many user objects. A comment is another model and also a set of its objects. Forum post, product, etc. - other models. And the selection of data from other tables for some record in the current one is then done through linking, there are several options, for example, JOIN to combine the results into one model or linking the tables themselves, or storing links in auxiliary tables, there are a lot of options, the choice of the right one depends on specifics of the task and requirements for query optimization.

I
Ilya Beloborodov, 2017-07-25
@kowap

No, not right. Correctly create the Users table, add the necessary fields there (such as mail, name, phone, city, etc.)

F
FanatPHP, 2017-07-25
@FanatPHP

Practice is the criterion of truth.
Make such a table, and then try to display all the comments under the article or the feed of the latest posts on the site.

B
Barmunk, 2017-07-25
@Barmunk

read this article
addphp.ru/materials/mysql/1_3.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question