网站等广告的 DBMS 设计
我不知道如何设计数据库管理系统来满足以下要求:
对于类似广告的网站,有很多类别。
每个类别都有可选的子类别。每个子类别可能有可选的子类别......等等。 根据每个类别(用户选择搜索),将有仅适用于该类别的搜索条件,例如:
如果用户选择了“汽车”类别,则将有以下搜索条件:制造商、型号、第一注册、燃料类型,但如果她选择公寓类别,则会有以下搜索条件:2 间卧室、3 间卧室、私人、代理 。
我希望我解释得尽可能简单。
I don't know how to design the dbms for the following requirement:
for an advertisement-like website there are a bunch of categories.
Every category has optional subcategories. Each subcategory may have optional subcategories ... and so on.
Depending on each category (the user has selected to search for) there will be search criteria which are applicable only to this category, for example:
if the user has chosen the category Autos there will be the following search criteria: make, model,first registration, fuel type, but if she chooses the category Flats there will be the following search criteria: 2 bedrooms,3 bedrooms, private, agency
.
I hope i explained it as simple as possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这意味着要处理分层数据,因此有多种模型可供选择,每种模型都有其局限性和优点。
我建议阅读 http://articles.sitepoint.com/article/hierarchical-data-database 在实际开始设计架构之前。对于我的项目,我使用了邻接列表方法,因为它更容易理解,但是当您需要查询它时,一切都会变得困难,所以也许嵌套集会更好。
MySql似乎推荐嵌套集 http://mikehillyer.com/articles/managing- mysql 中的分层数据/
This means handling hierarchical data so there are many models to choose from, each one with it's limitations and advantages.
I would recommend reading http://articles.sitepoint.com/article/hierarchical-data-database before actually starting to design your schema. For my projects i've used the adjacency list approach because it's simpler to understand, but when you need to query it everything becomes difficult so maybe a nested set would be better.
MySql seems to recommend nested set http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/
任何类别都可以有一个父类别,这样您就可以永远将它们脱壳
每个广告都有一个起始类别,如果该类别有子类别,则获取这些类别,如果它们有子类别,则无限获取这些广告
any category can have a parent category so you can shell them forever
every ad has a starting category, if that category has children, then get those, if they have children then get those ad infinitum