gpt4 book ai didi

database-design - 博客评论的数据库架构

转载 作者:行者123 更新时间:2023-12-04 07:16:10 24 4
gpt4 key购买 nike

我的博客上有一个评论表。

comment
- id (PK)
- post_id (FK)
- user_id (FK)
- comment

我应该拆分成 3 个表,然后这样做吗?

comment
- id (PK)
- comment

user_comment
- comment_id (PK, FK)
- user_id (PK, FK)

post_comment
- post_id (PK, FK)
- comment_id (PK, FK)

这会是更好的设计吗?欢迎任何其他建议。

最佳答案

你的原创设计很完美;它模拟实际发生的事情。

另外,最好避免架构膨胀。

关于database-design - 博客评论的数据库架构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12327451/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com