插入,更新和删除后的版本查询输出 [英] Version Query Output after Insert, Update and Delete

查看:86
本文介绍了插入,更新和删除后的版本查询输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是与Oracle SQL Expert考试有关的问题,有4种选择.它说正确的答案是C.但是我有一个疑问,认为D应该是答案,因为它使用Oracle FlashBack技术.任何人都可以解释一下.

Following is a question related to Oracle SQL Expert exam and have 4 choices. It says the correct answer is C. But I have a doubt and think that D should be the answer as this uses Oracle FlashBack technique. Can anybody explain this please.

谢谢.

Q)评估以下语句:

CREATE TABLE digits
(id NUMBER(2),
description VARCHAR2(15));
INSERT INTO digits VALUES (1,'ONE');
UPDATE digits SET description='TWO' WHERE id=1;
INSERT INTO digits VALUES (2, 'TWO');
COMMIT;
DELETE FROM digits;
SELECT description FROM digits
VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE;

上述查询的结果是什么?

What would be the outcome of the above query?

A.它不会显示任何值.

A. It wouldnot display any values.

B.它将显示两次值.

B. It would display the value TWO once.

C.我应该两次显示两次值.

C. Itwould display the value TWO twice.

D.它将显示值ONE,TWO和TWO.

D. It would display the values ONE, TWO, and TWO.

答案:C

推荐答案

这是一个棘手的问题,但是答案的确是C,因为从未提交过"ONE"的原始值,所以两个记录都被添加到了相同的事务,结果只有一个版本"包含两行,两行都带有"TWO"的描述.

This is a bit of a trick question, but the answer is indeed C, because the original value of "ONE" was never committed, both records were added in the same transaction and as a result there is only one "version" containing two rows, both with a description of "TWO".

这篇关于插入,更新和删除后的版本查询输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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