什么是dbms中的原子性 [英] What is atomicity in dbms

查看:345
本文介绍了什么是dbms中的原子性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在DBF中以1NF格式阅读下面的内容。



有一句话如下:


每一列都应该是原子的。


任何人都可以用一个例子?

解决方案


每一列都应该是原子的。 / blockquote>

Chris Date说,请注意,请注意,这不仅仅是简单的事情,例如整数3是合法的值。值可以是任意复杂的;例如,值可以是几何点或多边形,或X射线,或XML文档,或指纹,或阵列,或堆栈,或列表或关系(等等)。[1]



他还说,当且仅当在该relvar的每个法律价值中,每个元组[2]



他通常不鼓励使用原子这个词,因为它含有混乱的内涵。



例如,像2014-01-01这样的日期是单个值。这不是不可分割的;相反,它非常清楚地可分割。但dbms对具有部分的单个值执行两个操作之一。 dbms作为一个整体返回这些值,或者 dbms 提供操作部分的函数。 (客户不必编写代码来操作部分。)[3]



在日期的情况下,SQL可以




  • 作为一个整体返回日期( SELECT CURRENT_DATE ),

  • 日期的更多部分( EXTRACT(YEAR FROM CURRENT_DATE)),

  • 添加和减去间隔( CURRENT_DATE + INTERVAL'1'DAY ),

  • 从另一个日期中减去一个日期( CURRENT_DATE - DATE'2014-01-01' code>),



等。在这个(狭义)方面,SQL是相当关系的。







  1. ,第8版,p 113.强调原始版本。

  2. 同上,第358页。

  3. 在用户定义类型的情况下,用户假定是数据库程序员,而不是数据库的客户端。


I read something like below in 1NF form of DBMS.

There was a sentence as follows:

"Every column should be atomic."

Can anyone please explain it to me thoroughly with an example?

解决方案

"Every column should be atomic."

Chris Date says, "Please note very carefully that it is not just simple things like the integer 3 that are legitimate values. On the contrary, values can be arbitrarily complex; for example, a value might be a geometric point, or a polygon, or an X ray, or an XML document, or a fingerprint, or an array, or a stack, or a list, or a relation (and so on)."[1]

He also says, "A relvar is in 1NF if and only if, in every legal value of that relvar, every tuple contains exactly one value for each attribute."[2]

He generally discourages the use of the word atomic, because it has confusing connotations. Single value is probably a better term to use.

For example, a date like '2014-01-01' is a single value. It's not indivisible; on the contrary, it quite clearly is divisible. But the dbms does one of two things with single values that have parts. The dbms either returns those values as a whole, or the dbms provides functions to manipulate the parts. (Clients don't have to write code to manipulate the parts.)[3]

In the case of dates, SQL can

  • return dates as a whole (SELECT CURRENT_DATE),
  • return one or more parts of a date (EXTRACT(YEAR FROM CURRENT_DATE)),
  • add and subtract intervals (CURRENT_DATE + INTERVAL '1' DAY),
  • subtract one date from another (CURRENT_DATE - DATE '2014-01-01'),

and so on. In this (narrow) respect, SQL is quite relational.


  1. An Introduction to Database Systems, 8th ed, p 113. Emphasis in the original.
  2. Ibid, p 358.
  3. In the case of a "user-defined" type, the "user" is presumed to be a database programmer, not a client of the database.

这篇关于什么是dbms中的原子性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆