[每日一题] OCP1z0-047 :2013-07-15 drop column.........................................................4
2013-07-14 22:31
441 查看
有疑问可以去itpub讨论:http://www.itpub.net/thread-1802419-1-1.html
如下实验:
gyj@OCM> Create table emp(
2 Empno number(4) not null,
3 First_name varchar2(20),
4 Last_name varchar2(20),
5 Salary number(10,2),
6 Deptno number(2)
7 );
Table created.
gyj@OCM> insertinto emp values(100,'yijun','guo',35000,1);
1 row created.
gyj@OCM>commit;
Commit complete.
gyj@OCM> altertable emp drop column first_name; --有数据也能被删除!排除答案A
Table altered.
gyj@OCM> altertable emp drop column Empno;
Table altered.
gyj@OCM> altertable emp drop column last_name;
Table altered.
gyj@OCM> altertable emp drop column salary;
Table altered.
gyj@OCM> altertable emp drop column deptno;
alter table empdrop column deptno
*
ERROR at line 1:
ORA-12983: cannotdrop all columns in a table ----验证了答案B是对的
SET UNUSED Clause ---官方解释,排除答案C
Specify SET UNUSED to mark one or more columns asunused. Specifying this clause does not actually remove the target columns fromeach row in the table. That is, it does not restore the disk space used bythese columns. Therefore, the response
time is faster than when you execute theDROP clause.
清楚掉字典信息(撤消存储空间),不可恢复。
不要马上drop column,应该先setunused让column无法使用,避开系统尖峰时间再来处理删除栏位里的资料,要注意的是一但你set
unused column,这个栏位是无法再回复使用的。
gyj@OCM> altertable emp add first_name varchar2(10);
Table altered.
gyj@OCM> select *from emp;
DEPTNO FIRST_NAME
---------- ----------
1
gyj@OCM> updateemp set first_name='yijun';
1 row updated.
gyj@OCM> commit;
Commit complete.
gyj@OCM> ALTERTABLE emp SET UNUSED (first_name);
Table altered.
gyj@OCM> altertable emp drop unused column;
Table altered.
gyj@OCM> select *from emp;
DEPTNO
----------
1
gyj@OCM> alter table emp add first_name varchar2(10);
Table altered.
gyj@OCM> select * from emp
2 ;
DEPTNO FIRST_NAME
---------- ----------
1
gyj@OCM> update emp set first_name='yijun';
1 row updated.
gyj@OCM> commit;
Commit complete.
gyj@OCM> alter table emp add primary key(deptno,first_name);
Table altered.
yj@OCM> alter table emp drop column first_name;
alter table emp drop column first_name
*
ERROR at line 1:
ORA-12991: column is referenced in a multi-column constraint
gyj@OCM> alter table emp drop column first_name cascade constraints;
Table altered.
------验证了答案D是对的
答案:BD
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
如下实验:
gyj@OCM> Create table emp(
2 Empno number(4) not null,
3 First_name varchar2(20),
4 Last_name varchar2(20),
5 Salary number(10,2),
6 Deptno number(2)
7 );
Table created.
gyj@OCM> insertinto emp values(100,'yijun','guo',35000,1);
1 row created.
gyj@OCM>commit;
Commit complete.
gyj@OCM> altertable emp drop column first_name; --有数据也能被删除!排除答案A
Table altered.
gyj@OCM> altertable emp drop column Empno;
Table altered.
gyj@OCM> altertable emp drop column last_name;
Table altered.
gyj@OCM> altertable emp drop column salary;
Table altered.
gyj@OCM> altertable emp drop column deptno;
alter table empdrop column deptno
*
ERROR at line 1:
ORA-12983: cannotdrop all columns in a table ----验证了答案B是对的
SET UNUSED Clause ---官方解释,排除答案C
Specify SET UNUSED to mark one or more columns asunused. Specifying this clause does not actually remove the target columns fromeach row in the table. That is, it does not restore the disk space used bythese columns. Therefore, the response
time is faster than when you execute theDROP clause.
清楚掉字典信息(撤消存储空间),不可恢复。
不要马上drop column,应该先setunused让column无法使用,避开系统尖峰时间再来处理删除栏位里的资料,要注意的是一但你set
unused column,这个栏位是无法再回复使用的。
gyj@OCM> altertable emp add first_name varchar2(10);
Table altered.
gyj@OCM> select *from emp;
DEPTNO FIRST_NAME
---------- ----------
1
gyj@OCM> updateemp set first_name='yijun';
1 row updated.
gyj@OCM> commit;
Commit complete.
gyj@OCM> ALTERTABLE emp SET UNUSED (first_name);
Table altered.
gyj@OCM> altertable emp drop unused column;
Table altered.
gyj@OCM> select *from emp;
DEPTNO
----------
1
gyj@OCM> alter table emp add first_name varchar2(10);
Table altered.
gyj@OCM> select * from emp
2 ;
DEPTNO FIRST_NAME
---------- ----------
1
gyj@OCM> update emp set first_name='yijun';
1 row updated.
gyj@OCM> commit;
Commit complete.
gyj@OCM> alter table emp add primary key(deptno,first_name);
Table altered.
yj@OCM> alter table emp drop column first_name;
alter table emp drop column first_name
*
ERROR at line 1:
ORA-12991: column is referenced in a multi-column constraint
gyj@OCM> alter table emp drop column first_name cascade constraints;
Table altered.
------验证了答案D是对的
答案:BD
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-15 drop column.........................................................4
- [每日一题] OCP1z0-047 :2013-07-15 drop column
- [每日一题] OCP1z0-047 :2013-07-25 权限――角色与对象权限.............................................14
- [每日一题] OCP1z0-047 :2013-08-02 权限―――分配系统权限............................................22
- [每日一题] OCP1z0-047 :2013-08-14 如何理解USING INDEX?...................................4
- [每日一题] OCP1z0-047 :2013-08-16 merge的用法....................................................45
- [每日一题] OCP1z0-047 :2013-08-24 FLASHBACK—TABLE/PRIMARY KEY(FOREIGN KEY?)......98
- [每日一题] OCP1z0-047 :2013-08-26 TIMESTAMP WITH LOCAL TIME ZONE....................112
- [每日一题] OCP1z0-047 :2013-07-18 时间格式................................................................7
- [每日一题] OCP1z0-047 :2013-07-25 权限――角色与对象权限.............................................14
- [每日一题] OCP1z0-047 :2013-07-29 视图――别名..........................................................18
- [每日一题] OCP1z0-047 :2013-08-06 外表部――相关描述
- [每日一题] OCP1z0-047 :2013-08-14 如何理解USING INDEX?...................................41
- [每日一题] OCP1z0-047 :2013-08-18 禁用启用约束――主键与外键 ..................................61
- [每日一题] OCP1z0-047 :2013-07-13 oracle 10g正则表达式 REGEXP_LIKE 用法.....................................2
- [每日一题] OCP1z0-047 :2013-07-18 时间格式................................................................7
- [每日一题] OCP1z0-047 :2013-07-26 alter table set unused之后各种情况处理..................15
- [每日一题] OCP1z0-047 :2013-07-27 外部表――不能被DML和建索引...................................16
- [每日一题] OCP1z0-047 :2013-07-29 视图――别名..........................................................18
- [每日一题] OCP1z0-047 :2013-08-02 权限―――分配系统权限