S
S
Shrt2017-01-07 20:35:54
PHP
Shrt, 2017-01-07 20:35:54

What is the best way to implement adding comments under a topic in MySql (a field in the topics table or a separate table with comments)?

Good day to all!
The bottom line is, let's say there is a blog, a new entry is created (with fields - name, category, and so on), after creating a new blog entry, you must leave comments on this very blog entry. It's better to send these comments to a separate table, or just to a new field in an already existing table with "record name", "category", etc. fields.
Thanks a lot to everyone who will respond. And yes, of course, I understand that the question is stupid and noob, but I'm a newbie, please don't swear, because it's Christmas, holidays and all things .. :)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
cache0, 2017-01-07
@Shrt

new table with record id

T
ThunderCat, 2017-01-07
@ThunderCat

Each entity is a separate table, comments are an entity different from posts, entities are linked through connection keys, that is, there will be a post_id field in the comments that determines which post the comment belongs to. If the comments have a tree structure, another link field with the parent comment is added.

D
d-stream, 2017-01-07
@d-stream

There can be more than one comment on one post - as if hinting at a 1:N relationship

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question