OCP-1Z0-051-V9.02-47题
来源:互联网 发布:知乎 墨子号 编辑:程序博客网 时间:2024/06/13 22:57
47. View the Exhibit and examine the structure of ORD and ORD_ITEMS tables.
The ORD_NO column is PRIMARY KEY in the ORD table and the ORD_NO and ITEM_NO columns are
composite PRIMARY KEY in the ORD_ITEMS table.
Which two CREATE INDEX statements are valid? (Choose two.)
A. CREATE INDEX ord_idx1
ON ord(ord_no);
B. CREATE INDEX ord_idx2
ON ord_items(ord_no);
C. CREATE INDEX ord_idx3
ON ord_items(item_no);
D. CREATE INDEX ord_idx4
ON ord,ord_items(ord_no, ord_date,qty);
Answer: BC
答案解析:
参考:http://blog.csdn.net/rlhua/article/details/12780775
实验验证:
1、创建两张表
创建ord表
sh@TESTDB> create table ord
2 (ord_no number(2) not null,
3 ord_date date,
4 cust_id number(4));
Table created.
创建ord_items表
sh@TESTDB> create table ord_items
2 (ord_no number(2) not null,
3 item_no number(3) not null,
4 qty number(8,2));
Table created.
2、增加约束,使其满足题意
sh@TESTDB> alter table ord add constraint pk_ord primary key(ord_no);
Table altered.
sh@TESTDB> alter table ord_items add constraint pk_ord_item primary key(ord_no,item_no);
Table altered.
A错误,因为ord_no是主键,已经自动创建了一个唯一的索引,故不能再创建索引。
sh@TESTDB> create index ord_idx1 on ord(ord_no);
create index ord_idx1 on ord(ord_no)
*
ERROR at line 1:
ORA-01408: such column list already indexed
B,C正确,虽然在两列创建了主键约束,即自动创建的唯一索引是按照两列的组合来创建的,所以单列是可以创建索引的,
sh@TESTDB> CREATE INDEX ord_idx2
2 ON ord_items(ord_no);
Index created.
sh@TESTDB> CREATE INDEX ord_idx3
2 ON ord_items(item_no);
Index created.
D错误,属于语法错误,不能两张表同时建立索引
sh@TESTDB> CREATE INDEX ord_idx4
2 ON ord,ord_items(ord_no, ord_date,qty);
ON ord,ord_items(ord_no, ord_date,qty)
*
ERROR at line 2:
ORA-00906: missing left parenthesis
- OCP-1Z0-051-V9.02-47题
- OCP-1Z0-051-V9.02-1题
- OCP-1Z0-051-V9.02-1题
- OCP-1Z0-051-V9.02-1题
- OCP-1Z0-051-V9.02-11题
- OCP-1Z0-051-V9.02-12题
- OCP-1Z0-051-V9.02-14题
- OCP-1Z0-051-V9.02-15题
- OCP-1Z0-051-V9.02-17题
- OCP-1Z0-051-V9.02-18题
- OCP-1Z0-051-V9.02-21题
- OCP-1Z0-051-V9.02-118题
- OCP-1Z0-051-V9.02-120题
- OCP-1Z0-051-V9.02-32题
- OCP-1Z0-051-V9.02-33题
- OCP-1Z0-051-V9.02-93题
- OCP-1Z0-051-V9.02-94题
- OCP-1Z0-051-V9.02-95题
- spl_autoload_register 实现类的自动加载
- 吐槽一下ICDE的录取结果
- Documentation\filesystems\Sysfs-tagging
- C#文件、目录操作相关函数
- TCP协议和UDP协议数据传输
- OCP-1Z0-051-V9.02-47题
- 初识Volley(四)
- 去掉myEclipse的方括号自动补全功能
- android 相机报错 setParameters failed
- Android 去掉自定义dialog的白色边框
- IntelliJ Idea 快捷键
- 1T和12T单片机的区别
- HTTPS 协议更加安全,却为什么没有在互联网上全面采用呢?
- 如何改变Laucher中无源码的应用程序的图标