ITPub博客

首页 > 数据库 > Oracle > Oracle列操作

Oracle列操作

原创 Oracle 作者:zhenghaishu 时间:2014-08-24 11:46:21 0 删除 编辑
Oracle列操作

1 添加一列
语法:
alter table 表名 add (列名 数据类型);

例子:
SQL> create table test_table (id int);
Table created.

SQL> alter table test_table add (name varchar2(10));
Table altered.


2 改变列名
语法:
alter table 表名 rename column 原列名 to 新列名

例子:
SQL> alter table test_table rename column name to username;
Table altered.


3 改变列数据类型
语法:
alter table 表名 modify 列名 新数据类型

例子:
SQL> alter table test_table modify id number;
Table altered.


4 删除列
语法:
alter table 表名 drop column 列名;

例子:
SQL> alter table test_table drop column username;
Table altered.



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29485627/viewspace-1256737/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-02-14

  • 博文量
    112
  • 访问量
    1057345