首页 > 数据库 > Oracle > OCP考题解析_007:主键和索引
㈣ 主键与本地索引
测试:
hr@ORCL> drop table t purge; Table dropped. hr@ORCL> create table t (id number not null,p_id number) 2 partition by range (p_id) 3 ( 4 partition p1 values less than (2), 5 partition p2 values less than (3), 6 partition p3 values less than (4), 7 partition p4 values less than (5), 8 partition p5 values less than (maxvalue) 9 ); Table created. hr@ORCL> insert into t select rownum,decode(mod(rownum,5),0,5,mod(rownum,5)) from dual connect by level<=100000; 100000 rows created. hr@ORCL> commit; Commit complete. hr@ORCL> alter table t add constraint pk_t primary key (id) using index local; alter table t add constraint pk_t primary key (id) using index local * ERROR at line 1: ORA-14039: partitioning columns must form a subset of key columns of a UNIQUE index hr@ORCL> alter table t add constraint pk_t primary key (id,p_id) using index local; Table altered.
Q: 1 Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements insert a row into the table? (Choose three.) A. INSERT INTO employees VALUES ( NULL, \'John\', \'Smith\'); B. INSERT INTO employees( first_name, last_name) VALUES( \'John\', \'Smith\'); C. INSERT INTO employees VALUES ( \'1000\', \'John\', NULL); D. INSERT INTO employees (first_name, last_name, employee_id) VALUES ( 1000, \'John\', \'Smith\'); E. INSERT INTO employees (employee_id) VALUES (1000); F. INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, \'John\', \' \'); Answer: C, E, F
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26515977/viewspace-1208003/ ,如需转载,请注明出处,否则将追究法律责任。