为自动删除订阅系统构建表 [英] Building the tables for an Auto-drop subscription system

查看:31
本文介绍了为自动删除订阅系统构建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个系统,当某人订阅另一个邮件列表时,它会自动将某人从一个或多个邮件列表中删除.我有一个包含列表名称的表列表".每个列表都会有一个或多个排除项"形式的子项,这些子项基本上是其他列表.这是我的桌子:

I'm building a system that will auto-drop someone from one or more mailing lists, when they subscribe to another mailing list. I have a table 'lists' containing the list names. Each list will have one or more children in the form of 'exclusions', which are basically other lists. Here is my table:

我想知道如何最好地实现这一目标.我最初想通过具有多对多关系的查找表链接另一个名为排除项"的表,然后我可以获取特定列表名称的所有排除项.

I'm wondering how best to achieve this. I originally thought of having another table called 'exclusions' linked via a lookup table with a many-to-many relationship, then I could grab all the exclusions for a particular list name.

但是,排除项基本上与列表表中包含的列表名称相同,因此似乎那里有冗余数据.

However, the exclusions are basically the same list names that are contained in the lists table, so it seems like I have redundant data there.

是否有更好的方法来实现这一目标?我考虑向列表表中添加一个额外的列,其中包含我需要排除的其他列表的 ID.

Would there be a better way of acheiving this? I considered adding an extra column to the lists table, containing the ID's of the other lists that I need to exclude.

推荐答案

我发现答案就在这里,以连接"或映射"表的形式:如何将一个记录与同一记录中的另一个相关联表?

I found that the answer lies here, in the form of a 'junction' or 'mapping' table: How can I associate one record with another in the same table?

这篇关于为自动删除订阅系统构建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆