Are foreign keys really necessary in a database design?(数据库设计中真的需要外键吗?)
问题描述
据我所知,外键 (FK) 用于帮助程序员以正确的方式操作数据.假设一个程序员实际上已经以正确的方式这样做了,那么我们真的需要外键的概念吗?
As far as I know, foreign keys (FK) are used to aid the programmer to manipulate data in the correct way. Suppose a programmer is actually doing this in the right manner already, then do we really need the concept of foreign keys?
外键还有其他用途吗?我在这里遗漏了什么吗?
Are there any other uses for foreign keys? Am I missing something here?
推荐答案
外键有助于在数据级别强制执行参照完整性.它们还提高了性能,因为它们通常默认被编入索引.
Foreign keys help enforce referential integrity at the data level. They also improve performance because they're normally indexed by default.
这篇关于数据库设计中真的需要外键吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:数据库设计中真的需要外键吗?


基础教程推荐
- 什么是 orradiag_<user>文件夹? 2022-01-01
- oracle区分大小写的原因? 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 在多列上分布任意行 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01