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

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

问题描述

我在 DBMS 的 1NF 形式中读到类似下面的内容.

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

有一句话是这样的:

每一列都应该是原子的."

"Every column should be atomic."

谁能用一个例子向我彻底解释一下?

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

推荐答案

每一列都应该是原子的."

"Every column should be atomic."

Chris Date 说,请非常小心地注意,合法值不仅仅是像整数 3 这样简单的东西.相反,值可以是任意复杂的;例如,一个值可能是几何点、多边形、X 射线、XML 文档、指纹、数组、堆栈、列表或关系(等等)."[1]

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]

他还说,一个 relvar 是 1NF 当且仅当在该 relvar 的每个合法值中,每个元组中的每个属性都恰好包含一个值."[2]

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.

例如,像2014-01-01"这样的日期是单个值.它不是不可分割的;相反,它很明显可整除的.但是 dbms 使用具有部分的单个值执行两件事之一.dbms 要么作为一个整体返回这些值,要么dbms 提供操作这些部分的函数.(客户端不必编写代码来操作这些部件.)[3]

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]

在日期的情况下,SQL可以

In the case of dates, SQL can

  • 返回整个日期(SELECT CURRENT_DATE),
  • 返回日期的一个或多个部分 (EXTRACT(YEAR FROM CURRENT_DATE)),
  • 加减间隔(CURRENT_DATE + INTERVAL '1' DAY),
  • 从另一个日期中减去一个日期(CURRENT_DATE - DATE '2014-01-01'),
  • 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'),

等等.在这个(狭义)方面,SQL 是非常相关的.

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

  1. 数据库系统简介,第 8 版,第 113 页.强调原文.
  2. 同上,第 358 页.
  3. 在用户定义"类型的情况下,用户"被假定为数据库程序员,而不是数据库的客户.
  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天全站免登陆