[MySQL] Whether it's better to consolidate sub-tables with the same structure into one or give them to each parent table

Asked 2 years ago, Updated 2 years ago, 30 views

For example, there is a posts table and a users table, and there is a likes table and a bookmarks table.

Both likes and bookmarks have FK keys of the top table posts and users

If you leave only one like table and make a parentTable column and parentId column

FROM
    parentTable = "posts" AND
    parentId = 1

Is it better to select like this?

Make a table called posts_likes and fill in the parentId

FROM
    parentId = 1

I don't know if it's good to do it this way.

mysql

2022-09-22 18:49

1 Answers

In this case, it seems that the design concept will eventually have to be decided.


2022-09-22 18:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.