PHP mySQL 一对多与多对多

发布于 2024-12-26 04:53:04 字数 234 浏览 1 评论 0原文

我正在做一个宠物项目,它是一个社会概念。当前的概念是支持数据然后查询它们的表。对于这个想法,我只是想从简单开始,逐步向上。该理论就像任何其他社交网站一样。只是一个评论系统,有n分之一的人与他们选择的特定人分享。我理解这个概念,但无法理解其中的逻辑,但也许是因为我还没有找到值得一提的文章和/或与此相关的示例。

也就是说,我开始尊重人们从这个网站提供的丰富知识,并寻求入门帮助。这些表格以及相应的查询会是什么样子,以开始构建我想要做的概念。

I have a pet project I am working on that is a social concept. The concept at hand is the tables to support the data then query them. For this notion I am just wanting to start simple and build my way up. The theory is like any other social site. Just a comment-esk system with 1-nth number of people sharing with specific people of their choice. I understand the concept but can't wrap my head around the logic yet maybe its because I haven't found a note worthy article yet and/or example there of for that matter.

So that said I have come to respect the wealth of knowledge people have to offer from this site and am asking for help on getting started. What would the tables look like along with corresponding queries to start building up the concept I am looking to do.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

永言不败 2025-01-02 04:53:04

一个有趣的起点可能是研究术语“多对多”。虽然是一个常用术语,但它通常并不像一对多那么简单。虽然这是一种描述关系的完美方式,但它在 SQL 术语中并不是那么重要,因为它是不可能的。解决此问题的一种简单方法是使用三个表,两个表用于保存关系中的内容,一个表用于连接它们。

这里可能有一个有趣的阅读: http://www.tonymarston.net/php -mysql/多对多.html

An interesting place to start could be looking into the term "many-to-many". While a commonly used term, it isn't usually as simple as a one-to-many. While it is a perfectly fine way to describe a relationship, it's not so much in SQL terms as it isn't possible. A simple way around this is having three tables, two to hold the things in the relationship and one table to connect them.

An interesting read here possibly: http://www.tonymarston.net/php-mysql/many-to-many.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文