如下实验:

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

[每日一题] OCP1z0-047 :2013-07-15 drop column的更多相关文章

  1. CISP/CISA 每日一题 15

    CISA 每日一题(答) 作业记帐: 监控和记录信息系统资源的使用,这些信息可被信息系统审计师用来执行: 1.将资源使用和相关用户挂钩以便实行计费: 2.通过改变系统软件的默认设置来最优化硬件性能 作 ...

  2. 老男孩IT教育-每日一题汇总

    老男孩IT教育-每日一题汇总 第几天 第几周 日期 快速访问链接 第123天 第二十五周 2017年8月25日 出现Swap file….already exists以下错误如何解决? 第122天 2 ...

  3. [每日一题] 11gOCP 1z0-052 :2013-09-1 RMAN-- repair failure........................................A20

    转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/10859315 正确答案:D 一.模拟上题的错误: 1.删除4号文件 [oracle@myd ...

  4. CISP/CISA 每日一题 五

    CISA 每日一题(答) 信息系统审计师要确认系统变更程序中的: 1.变更需求应有授权.优先排序及跟踪机制: 2.日常工作手册中,明确指出紧急变更程序: 3.变更控制程序应同时为用户及项目开发组认可: ...

  5. [每日一题]面试官问:谈谈你对ES6的proxy的理解?

    [每日一题]面试官问:谈谈你对ES6的proxy的理解? 关注「松宝写代码」,精选好文,每日一题 作者:saucxs | songEagle 一.前言 2020.12.23 日刚立的 flag,每日一 ...

  6. 【JavaScript】Leetcode每日一题-在D天内送包裹的能力

    [JavaScript]Leetcode每日一题-在D天内送包裹的能力 [题目描述] 传送带上的包裹必须在 D 天内从一个港口运送到另一个港口. 传送带上的第 i 个包裹的重量为 weights[i] ...

  7. 【JavaScript】Leetcode每日一题-二叉搜索树的范围和

    [JavaScript]Leetcode每日一题-二叉搜索树的范围和 [题目描述] 给定二叉搜索树的根结点 root,返回值位于范围 [low, high] 之间的所有结点的值的和. 示例1: 输入: ...

  8. 【python】Leetcode每日一题-寻找旋转排序数组中的最小元素

    [python]Leetcode每日一题-寻找旋转排序数组中的最小元素 [题目描述] 已知一个长度为 n 的数组,预先按照升序排列,经由 1 到 n 次 旋转 后,得到输入数组.例如,原数组nums ...

  9. 【JavaScript】【dp】Leetcode每日一题-解码方法

    [JavaScript]Leetcode每日一题-解码方法 [题目描述] 一条包含字母 A-Z 的消息通过以下映射进行了 编码 : 'A' -> 1 'B' -> 2 ... 'Z' -& ...

  10. [LeetCode每日一题]153.寻找旋转排序数组中的最小值

    [LeetCode每日一题]153.寻找旋转排序数组中的最小值 问题 已知一个长度为 n 的数组,预先按照升序排列,经由 1 到 n 次 旋转 后,得到输入数组.例如,原数组 nums = [0,1, ...

随机推荐

  1. SQL常规查询详解

    一.交叉连接(cross join) 交叉连接(cross join):有两种,显式的和隐式的,不带on子句,返回的是两表的乘积,也叫笛卡尔积. 例如:下面的语句1和语句2的结果是相同的. 语句1:隐 ...

  2. Kafka集群在空载情况下Cpu消耗比较高的问题

    线上kafka与storm的空载情况下负载都比较高, kafka达到122%, storm平均负载达到, 20%,  当前是通过Ambari下管理kafka的, a. 先停止s5的kafka进程.b. ...

  3. 一步一步写算法(之挑选最大的n个数)

    原文:一步一步写算法(之挑选最大的n个数) [ 声明:版权所有,欢迎转载,请勿用于商业用途.  联系信箱:feixiaoxing @163.com] 从一堆数据中挑选n个最大的数,这个问题是网上流传的 ...

  4. php利用SoapClient调用webservices

    原文:php利用SoapClient调用webservices 1.开启soap支持,在php.ini中去除extension=php_soap.dll之前的':' 2.掉用页面 <?php h ...

  5. 笔试题&amp;面试题:CW输出矩阵

    称号:CW输出矩阵(N*N). 如果一个矩阵: 1   2   3   4 5   6   7   8 9  10 11 12 13 14 15 16 那么程序应该给出的输出为:1 2 3 4 8 1 ...

  6. 【转】仿QQ5.0侧滑菜单ResideMenu

    本文由孙国威 原创.如需转载,请注明出处! 原文:http://blog.csdn.net/manoel/article/details/39013095 为了后续对这个项目进行优化,比如透明度动画. ...

  7. 【转】android webview设置内容的字体大小

    Enum for specifying the text size. SMALLEST is 50% SMALLER is 75% NORMAL is 100% LARGER is 150% LARG ...

  8. Forget Java to learn Javascript from 0.--Day 1

    The first day,when I read 'we need practice so we need a Javascript Interpreter.','Every browser has ...

  9. Visual Studio 自定义项目或工程模板

    如何利用 Visual Studio 自定义项目或工程模板 在开发项目的时候,由其是商业性质的大型项目时,往往需要在每个代码文件上都加上一段关于版权.开发人员的信息,并且名称空间上都需要带有公司的标志 ...

  10. 实现Client Credentials Grant

    [OAuth]基于DotNetOpenAuth实现Client Credentials Grant   Client Credentials Grant是指直接由Client向Authorizatio ...