使用哪种数据模型来表示小型 SQL 数据库中的嵌套类别?
我正在编写一个小型工作网站,员工可以在其中查阅有关如何使用我们使用的不同程序的视频胶囊。我被要求按类别组织视频,并且类别需要任意嵌套。
我一直在研究两种建模方法:嵌套集和邻接表。它们似乎都有各自的优点和缺点,我想知道是否有人可以帮助我选择最适合我的使用场景的模型。
- 我想在菜单中显示类别以及该类别下的视频数量
- 该网站将每周更新一次(如果是的话)。大部分数据库活动都是读取。
- 该网站不会被大量访问。我预计不会同时有超过 2-3 个用户。
- 类别很可能会在我们建立网站时建立,之后很少(如果有的话)被触及。也许会添加一些类别,但我不希望类别被删除或在树中移动。
- 这是一份暑期工作,所以我希望在我离开后会有其他人来维护该网站。
谢谢你的帮助。
I am writing a small web site for work where employees can consult video capsules on how to use the different programs that we use. I was asked to organize the videos by categories and the categories need to be arbitrarily nested.
I've been looking into two ways to model this: nested sets and adjacency lists. They both seem to have their ups and downs, and I was wondering if somebody could help me choose the model that would best fit my usage scenario.
- I want to display the categories in a menu along with the number of videos under that category
- The site will be updated once a week, if that. The majority of the database activity is going to be reading.
- The site will not be heavily visited. Never more than 2-3 users at once I'd expect.
- Categories are likely going to be established when we build the site and rarely (if ever) touched afterwards. Maybe some categories will be added, but I don't expected categories to be deleted or moved around in the tree.
- This is a summer job, so I expect that somebody else will maintain the site after I'm gone.
Thank you for you help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果它是一个小型的、很少使用的数据库,不太可能看到很多变化……我不会担心这个问题。不要花很多时间思考:以最简单、最直接、最容易理解/实现的方式去做。
正如他们所说,完成了。
If it's a small lightly used database that's unlikely to see a lot of change....I wouldn't sweat the issue. Don't spend a lot of time thinking on it: just do it in the simplest, most straightforward, easiest to understand/implement manner.
Git'er done, as they say.