[每日一题] OCP1z0-047 :2013-07-16 主键与唯一索引.............................................................5
2013-07-16 00:11
513 查看
有疑问可以去itpub讨论:http://www.itpub.net/thread-1802421-1-1.html
主键包括非空和唯一约束,它会自动创建唯一索引(注:唯一约束也会自动创建唯一索引),测试如下:
1、 创建一个表products
gyj@OCM> Create table products(
2 product_id number(6) constraintprod_id_pk PRIMARY KEY,
3 product_name varchar2(15)
4 );
Table created.
2、 查表products的索引
gyj@OCM> select INDEX_NAME,INDEX_TYPE,UNIQUENESS fromuser_indexes where TABLE_NAME='PRODUCTS';
INDEX_NAME INDEX_TYPE UNIQUENES
------------------------------ --------------------------- ---------
PROD_ID_PK NORMAL UNIQUE
答案:B
补充:唯一约束也会自动创建唯一索引
gyj@OCM> create table t10 (id int unique,name varchar2(10));
Table created.
gyj@OCM> select INDEX_NAME,INDEX_TYPE,UNIQUENESS from user_indexes where TABLE_NAME='T10';
INDEX_NAME INDEX_TYPE UNIQUENES
------------------------------ --------------------------- ---------
SYS_C0011336 NORMAL UNIQUE
QQ:252803295
学习交流QQ群:
DSI&Core Search Ⅰ 群:127149411(技术:已满)
DSI&Core Search Ⅱ 群:177089463(技术:未满)
DSI&Core Search Ⅲ 群:284596437(技术:未满)
DSI&Core Search Ⅳ 群:192136702(技术:未满)
DSI&Core Search Ⅴ 群:285030382(闲聊:未满)
MAIL:oracledba_cn@hotmail.com
BLOG: http://blog.csdn.net/guoyjoe
WEIBO:http://weibo.com/guoyJoe0218
ITPUB: http://www.itpub.net/space-uid-28460966.html
OCM: http://education.oracle.com/education/otn/YGuo.HTM
主键包括非空和唯一约束,它会自动创建唯一索引(注:唯一约束也会自动创建唯一索引),测试如下:
1、 创建一个表products
gyj@OCM> Create table products(
2 product_id number(6) constraintprod_id_pk PRIMARY KEY,
3 product_name varchar2(15)
4 );
Table created.
2、 查表products的索引
gyj@OCM> select INDEX_NAME,INDEX_TYPE,UNIQUENESS fromuser_indexes where TABLE_NAME='PRODUCTS';
INDEX_NAME INDEX_TYPE UNIQUENES
------------------------------ --------------------------- ---------
PROD_ID_PK NORMAL UNIQUE
答案:B
补充:唯一约束也会自动创建唯一索引
gyj@OCM> create table t10 (id int unique,name varchar2(10));
Table created.
gyj@OCM> select INDEX_NAME,INDEX_TYPE,UNIQUENESS from user_indexes where TABLE_NAME='T10';
INDEX_NAME INDEX_TYPE UNIQUENES
------------------------------ --------------------------- ---------
SYS_C0011336 NORMAL UNIQUE
QQ:252803295
学习交流QQ群:
DSI&Core Search Ⅰ 群:127149411(技术:已满)
DSI&Core Search Ⅱ 群:177089463(技术:未满)
DSI&Core Search Ⅲ 群:284596437(技术:未满)
DSI&Core Search Ⅳ 群:192136702(技术:未满)
DSI&Core Search Ⅴ 群:285030382(闲聊:未满)
MAIL:oracledba_cn@hotmail.com
BLOG: http://blog.csdn.net/guoyjoe
WEIBO:http://weibo.com/guoyJoe0218
ITPUB: http://www.itpub.net/space-uid-28460966.html
OCM: http://education.oracle.com/education/otn/YGuo.HTM
相关文章推荐
- [每日一题] OCP1z0-047 :2013-07-16 主键与唯一索引
- [每日一题] OCP1z0-047 :2013-07-16 主键与唯一索引.............................................................5
- [每日一题] OCP1z0-047 :2013-08-18 禁用启用约束――主键与外键 ..................................61
- [每日一题] OCP1z0-047 :2013-08-18 禁用启用约束――主键与外键 ..................................61
- [每日一题] OCP1z0-047 :2013-07-27 外部表――不能被DML和建索引...................................16
- [每日一题] OCP1z0-047 :2013-08-18 禁用启用约束――主键与外键 ..................................61
- [每日一题] OCP1z0-047 :2013-07-27 外部表――不能被DML和建索引...................................16
- [每日一题] OCP1z0-047 :2013-07-30 表连接――内联视图当作表使用....................................19
- [每日一题] OCP1z0-047 :2013-08-04 INSERT --- WITH CHECK OPTION...........................24
- [每日一题] OCP1z0-047 :2013-08-05 SELECT语句――列的表达式.....................................25
- [每日一题] OCP1z0-047 :2013-08-11 描述层次查询(hierarchical query)
- [每日一题] OCP1z0-047 :2013-08-16 merge的用法....................................................45
- [每日一题] OCP1z0-047 :2013-08-25 正则表达式REGEXP_LIKE-----‘harddisks’.................108
- [每日一题] OCP1z0-047 :2013-07-12 多表插入................................................................1
- [每日一题] OCP1z0-047 :2013-07-14 正则表达式...............................................................3
- [每日一题] OCP1z0-047 :2013-07-30 表连接――内联视图当作表使用....................................19
- [每日一题] OCP1z0-047 :2013-08-04 INSERT --- WITH CHECK OPTION...........................24
- [每日一题] OCP1z0-047 :2013-08-05 SELECT语句――列的表达式.....................................25
- [每日一题] OCP1z0-047 :2013-08-07 SELECT---PRODUCT_INFORMATION...................27
- [每日一题] OCP1z0-047 :2013-08-19 DATE TYPE............................................