[每日一题] OCP1z0-047 :2013-08-14 如何理解USING INDEX?...................................41
正确答案:B
一、USING INDEX的实验:
、USING INDEX可以让你在创建主键、唯一性约束的时候使用指定的索引或创建索引、或修改索引的存储结构。
OK,我先不用USING INDEX,创建主键时Oracle自动创建唯一索引。
gyj@MYDB> alter table emp add constraint emp_id_pk primary key(employee_id); Table altered. gyj@MYDB> select INDEX_NAME from user_constraints where CONSTRAINT_NAME='EMP_ID_PK'; INDEX_NAME
------------------------------
EMP_ID_PK gyj@MYDB> select UNIQUENESS from user_indexes where index_name='EMP_ID_PK'; UNIQUENES
---------
UNIQUE
、这时我想把主键删除,但我想保留唯一索引EMP_ID_PK,即约束可以被独立drop,而索引可以保留。
gyj@MYDB> ALTER TABLE emp DROP PRIMARY KEY KEEP INDEX; Table altered. gyj@MYDB> select UNIQUENESS from user_indexes where index_name='EMP_ID_PK'; UNIQUENES
---------
UNIQUE gyj@MYDB> select INDEX_NAME from user_constraints where CONSTRAINT_NAME='EMP_ID_PK'; no rows selected
、然后我又想创建主键,但我想直接用刚刚创建的唯一索引EMP_ID_PK。此时我就要用USING INDEX。
gyj@MYDB> alter table emp add constraint emp_id_pk primary key(employee_id) using index EMP_ID_PK; Table altered.
二、 USING INDEX在官方文的解释:
Using Indexes to Enforce Constraints
When defining the state of a unique or primary key constraint, you can specify an index for Oracle to use to enforce the constraint, or you can instruct Oracle to create the index used to enforce the constraint.
using_index_clauseYou can specify the using_index_clause only when enabling unique or primary key constraints. You can specify the clauses of theusing_index_clause in any order, but you can specify each clause only once.
If you specify
schema.index, then Oracle attempts to enforce the constraint using the specified index. If Oracle cannot find the index or cannot use the index to enforce the constraint, then Oracle returns an error.If you specify the
create_index_statement, then Oracle attempts to create the index and use it to enforce the constraint. If Oracle cannot create the index or cannot use the index to enforce the constraint, then Oracle returns an error.If you neither specify an existing index nor create a new index, then Oracle creates the index. In this case:
The index receives the same name as the constraint.
If
tableis partitioned, then you can specify a locally or globally partitioned index for the unique or primary key constraint.
Restrictions on theusing_index_clause The following restrictions apply to theusing_index_clause:
You cannot specify this clause for a view constraint.
You cannot specify this clause for a
NOTNULL, foreign key, or check constraint.You cannot specify an index (
schema.index) or create an index (create_index_statement) when enabling the primary key of an index-organized table.You cannot specify the
domain_index_clauseofindex_propertiesor theparallel_clauseofindex_attributes.
[每日一题] OCP1z0-047 :2013-08-14 如何理解USING INDEX?...................................41的更多相关文章
- Cheatsheet: 2013 08.14 ~ 08.19
.NET Lucene.Net ultra fast search for MVC or WebForms site => made easy! C# State Machines HttpCl ...
- CISP/CISA 每日一题 14
CISA 每日一题(答) 自动无人值守运行(LIGHTS-OUT)优势:1.信息系统运行成本的遏制/减少:2.持续运行(24/7):3.减少系统错误和中断次数. I/O 控制人员负责保证:1.批处理信 ...
- 老男孩IT教育-每日一题汇总
老男孩IT教育-每日一题汇总 第几天 第几周 日期 快速访问链接 第123天 第二十五周 2017年8月25日 出现Swap file….already exists以下错误如何解决? 第122天 2 ...
- PL/SQL Challenge 每日一题:2014-3-14 11gR2中带RELIES_ON子句的RESULT_CACHE函数
PL/SQL Challenge 每日一题:2014-3-14 11gR2中带RELIES_ON子句的RESULT_CACHE函数 最先答对且答案未经编辑的puber将获得纪念章一枚(答案不可编辑但可 ...
- CISP/CISA 每日一题 五
CISA 每日一题(答) 信息系统审计师要确认系统变更程序中的: 1.变更需求应有授权.优先排序及跟踪机制: 2.日常工作手册中,明确指出紧急变更程序: 3.变更控制程序应同时为用户及项目开发组认可: ...
- [每日一题]面试官问:谈谈你对ES6的proxy的理解?
[每日一题]面试官问:谈谈你对ES6的proxy的理解? 关注「松宝写代码」,精选好文,每日一题 作者:saucxs | songEagle 一.前言 2020.12.23 日刚立的 flag,每日一 ...
- 【JavaScript】Leetcode每日一题-在D天内送包裹的能力
[JavaScript]Leetcode每日一题-在D天内送包裹的能力 [题目描述] 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口. 传送带上的第 i 个包裹的重量为 weights[i] ...
- 【python】Leetcode每日一题-寻找旋转排序数组中的最小元素
[python]Leetcode每日一题-寻找旋转排序数组中的最小元素 [题目描述] 已知一个长度为 n 的数组,预先按照升序排列,经由 1 到 n 次 旋转 后,得到输入数组.例如,原数组nums ...
- 【JavaScript】【dp】Leetcode每日一题-解码方法
[JavaScript]Leetcode每日一题-解码方法 [题目描述] 一条包含字母 A-Z 的消息通过以下映射进行了 编码 : 'A' -> 1 'B' -> 2 ... 'Z' -& ...
随机推荐
- Direct 2D实现界面库 (1)
大学时尝试过很多次写一个UI库, 初次使用 GDI 绘图, 当时水平很低, GDI功能太弱, 以失败而告终. 之后使用 GDI+ 绘图, 当时水平依旧很低, GDI功能很强, 但效率实在太慢, 以失败 ...
- Codeforces 475 D.CGCDSSQ
题目说了a的范围小于10^9次方,可实际却有超过的数据...真是醉了 算出以f[i]结尾的所有可能GCD值,并统计: f[i]可以由f[i-1]得出. /* 递推算出所有GCD值,map统计 */ # ...
- C# ToString常用技巧总结
ToString是在开发中最常用的操作,其作用是将其它类型以字符串类型表示.例如: int i=2;i.ToString() //”2″Object o = new Object();o.ToStri ...
- .Net用js实现aspx页面删除TextBox输入框的前后空格
去掉TextBox输入框两头的前后空格:onblur="this.value=this.value.replace(/^\s+|\s+$/g,'');" str为要去除空格的字符串 ...
- qt环境问题导致的编译错误
/usr/include/qt5/QtCore/qprocess.h:245:24: error: missing binary operator before token "(" ...
- ObjectiveC1基础代码——类和对象
// // main.m // ObjectiveC1 // // Created by scjy on 15/10/30. // Copyright © 2015年 lizhipeng. A ...
- bzoj2180: 最小直径生成树
Description 输入一个无向图G=(V,E),W(a,b)表示边(a,b)之间的长度,求一棵生成树T,使得T的直径最小.树的直径即树的最长链,即树上距离最远的两点之间路径长度. Input 输 ...
- 如何将BarTender内容锁定不让改动
条码标签代表的是产品的特性等,具有相当的精确性,所以需要保证它的正确性.而使用BarTender软件,可以帮助小伙伴将设计的条码标签内容锁定,保护它而不被人改动.下面,小编就教教大家如何实现BarTe ...
- hadoop job执行完的统计信息
Total committed heap usage (bytes)= Physical memory (bytes) snapshot= Virtual memory (bytes) snapsho ...
- 清除html的标签和行内样式
function shieldStyle(){ this._styleStartArr=["<span","<p","<strong ...