数据库规范化究竟做什么?

编程入门 行业动态 更新时间:2024-10-28 18:31:21
本文介绍了数据库规范化究竟做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

新的数据库,所以没有得到生气的简单的问题。 只要我的搜索和收集的知识规范化减少数据的冗余和提高性能。但实际上,我不明白将主表分成其他小表,应用它们之间的关系,使用所有可能的联合,子查询,联接等检索数据的确切原因,为什么我们不能拥有所有的数据单个表并根据需要检索它们。我很困惑。

New to database and so no to get upset with simple questions. As far as my googled and gathered knowledge normalization reduces redundancy of data and increase the performance. But really, I didn't understand what exact reason for dividing the master table into other small tables, applying relationship among them, retrieving the data using all possible unions,subqueries,joins etc., Why can't we have all the data in a single table and retrieve them as on required. I'm little confused.

推荐答案

主要原因是为了消除重复的数据,例如,如果你有一个用户多个地址,并且您将此信息存储在单个表中,用户信息将与每个地址条目一起复制。规范化将地址分离到自己的表中,然后使用键链接两个。这样你不需要复制用户数据,你的数据库结构变得更清洁了。

The main reason is to eliminate repetition of data, so for example if you had a user with multiple addresses and you stored this information in a single table the user information would be duplicated along with each address entry. Normalisation would seperate the addresses into their own table and then link the two using keys. This way you wouldn't need to duplicate the user data, and your db structure becomes a little cleaner.

完全规范化通常不会提高性能,事实上它可以使它更糟,但它会保持您的数据重复的免费。事实上,在某些特殊情况下,我已对某些特定数据进行了规范化,以提高性能。

Full normalisation will generally not improve performance, in fact it can often make it worse but it will keep your data duplicate free. In fact in some special cases I've denormalised some specific data in order to get a performance increase.

更多推荐

数据库规范化究竟做什么?

本文发布于:2023-11-22 09:18:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616850.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:做什么   数据库

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!