数据库设计中真的需要外键吗?

2023-09-18数据库问题
5

本文介绍了数据库设计中真的需要外键吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

据我所知,外键 (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.

这篇关于数据库设计中真的需要外键吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同
Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)...
2024-04-16 数据库问题
13

定义外键有什么好处
what are the advantages of defining a foreign key(定义外键有什么好处)...
2024-04-16 数据库问题
7

音乐库 MySQL 数据库
Music library MySQL database(音乐库 MySQL 数据库)...
2024-04-16 数据库问题
6

理解mysql解释
understanding mysql explain(理解mysql解释)...
2024-04-16 数据库问题
8

价格是浮点数还是小数点?
Float or decimal for prices?(价格是浮点数还是小数点?)...
2024-04-16 数据库问题
5

存储用户并传入单表或单表
store users and pass in single table or separate table(存储用户并传入单表或单表)...
2024-04-16 数据库问题
5