Answer the question
In order to leave comments, you need to log in
How to organize the database structure?
Good afternoon. I'm new to the database, I'm asking for help in designing the structure.
There are posts, topics and users in the system. It is necessary to organize so that there is maximum productivity.
Posts correspond to certain topics from the topic table, one post per user (not necessarily the user can have a post).
Access to the list of posts of a particular user and the topic of each post is required.
You also need access to the answers of all users on this topic.
My algorithm is the following:
There are 4 tables: posts, topics, users and a separate table for each user (as an attribute).
For each object (user) in the users table, create a separate table as an attribute in which all topics will be listed and they will be matched with the BOOL attribute "post presence" and, if any, the post id in the general posts table.
But I don’t know if it is possible to organize nested tables (for users), and how to do it correctly (for optimization).
I’m not sure about the DBMS yet, I read that if you just need to pull queries, then MySQL will be safer and faster, at first I looked at PostgreSQL.
I will be very grateful for your answers. Thanks
Answer the question
In order to leave comments, you need to log in
topic table, user table, message table.
messages - message id, user (link to the table of users), topic (link to the table of topics), text (if desired + date + what message the answer to)
topics - topic id (link to the table of messages), topic name, author (if necessary. connection with the table of users)
user - user id (connection with tables of topics and messages), name + any other type of mail, date of birth, etc.
something like this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question