在关系数据库中存储 XML 会如何违反规范化原则?

编程入门 行业动态 更新时间:2024-10-28 06:35:50
本文介绍了在关系数据库中存储 XML 会如何违反规范化原则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在本书中:Regina Obe &Leo Hsu, PostgreSQL Up &跑步,第.101.它是作为对 PostgreSQL XML 数据类型的介绍而编写的:

In this book: Regina Obe & Leo Hsu, PostgreSQL Up & Running, p. 101. It is written as an introduction to PostgreSQL XML data-type:

XML 数据类型,类似于 JSON,在关系型中是有争议的"数据库,因为它违反了规范化原则.

The XML data type, similar to JSON, is "controversial" in a relational database because it violates principles of normalization.

不做进一步解释.有人可以详细说明什么是规范化原则以及为什么 XML 确实违反了其中一些原则.

Without further explanation. Could someone detail what is normalization principles and why XML does violate some of those principles.

推荐答案

在书籍和网络上有很多关于关系数据库规范化的教程.参见例如 en.wikipedia/wiki/Database_normalization

There are many tutorials on relational database normalization in books and on the web. See for example en.wikipedia/wiki/Database_normalization

第一个范式表示列应该只包含原子"或不可分割"的值——如果你过于严格地解释它意味着你甚至不允许存储日期.将 XML 文档存储在列中肯定违背了该原则.这并不意味着这样做一定是件坏事,只是您需要了解后果(这通常意味着更新数据库并保持一致会更加困难).

First normal form says that a column should contain only "atomic" or "indivisible" values - which if you interpret it over-strictly means you're not even allowed to store a date. Storing an XML document in a column certainly goes against that principle. Which doesn't mean it's necessarily a bad thing to do, just that you need to be aware of the consequences (which generally means that updating the database and keeping it consistent is going to be more difficult).

更多推荐

在关系数据库中存储 XML 会如何违反规范化原则?

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

发布评论

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

>www.elefans.com

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