数据库MN关系 [英] Database MN relationship

查看:736
本文介绍了数据库MN关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库管理系统(绝对初学者)上课,我正在一个非常简单的博客系统的数据库。



我有一个关于博客帖子和帖子所属类别之间的一个M:N关系的问题(一个博客帖子可以分成几个类别。)



计划的部分如下所示:
计划



我知道这种方案允许添加不属于任何类别的博客帖子。但是,我不知道为什么。

解决方案

这可能是两件事的组合。一个是你的数据库设计中缺乏引用完整性,即你需要外键。另一个是你的前端应用程序允许博客没有类别的发布。


I'm taking a class on database management systems (absolute beginner) and I'm working on a database for a very simple blog system.

I have a question regarding one M:N relationship between blog posts and categories where the posts belong (one blog posts can be in several categories.)

The part of the scheme looks like this: Scheme

I know that somehow this scheme allows to add a blog post that doesn't belong to any category. However, I don't know why that is. Could someone please explain this to me?

Thanks.

解决方案

It's probably a combination of two things. One would be a lack of referential integrity in your database design, ie you need foreign keys. The other would be that your front end application is allowing blogs without categories to be posted.

这篇关于数据库MN关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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