Home mail me! Syndicate this site using RSS

Archive for TAG: InnoDB

MySQL 的外键与参照完整性: Part 1

1. 什么是参照完整性?
——————–
参照完整性(完整性约束)是数据库设计中的一个重要概念,当数据库中的一个表与一个或多个表进行关联时都会涉及到参照完整性。比如下面这个例子:
文章 分类表 – categories
category_id name
1 SQL Server
2 Oracle
3 PostgreSQL
5 SQLite

文章表 – articles
article_id category_id title
1 1 aa
2 2 bb
3 4 cc

可见以上两个表之间是通过category_id,其中categories表有4条记录,articles表有3条记录。
Read more…

1 Comment »