164. Examine the command that is used to create a table:
SQL> CREATE TABLE orders(oid NUMBER(6) PRIMARY KEY, odate DATE, ccode NUMBER
(6), oamt NUMBER(10,2)) TABLESPACE users;
Which two statements are true about the effect of the above command? (Choose two.)
A.A CHECK constraint is created on the OID column.
B.A NOT NULL constraint is created on the OID column.
C.The ORDERS table is the only object created in the USERS tablespace.
D.The ORDERS table and a unique index are created in the USERS tablespace.
E.The ORDERS table is created in the USERS tablespace and a unique index is created on the OIDcolumn in the SYSTEM tablespace.
Answer: BD
答案解析:
A。在oid 列上不是check约束,是主键约束。
B。在oid 列上有主键约束,主键约束包含唯一约束和非空约束,故正确。
C。因为在oid 列上有主键索引,故会自动创建唯一索引,故对象不只ORDERS 表,还有一个索引。
D。默认情况下,users是用户创建对象默认的表空间,所以创建的表和索引都放在users表空间里。
E。ORDERS 被创建在USERS表空间,唯一性索引页被创建在USERS表空间,而不是SYSTEM表空间。
所以选BD.

本文探讨了使用SQL命令创建带有主键约束的表的方法。主键约束不仅确保了OID列的唯一性,还自动为该列添加了非空约束,并在指定的表空间中创建了一个唯一的索引。
2221

被折叠的 条评论
为什么被折叠?



