oracle的一些常规操作sql语句集

来源:互联网 发布:lrc歌词编辑软件 编辑:程序博客网 时间:2024/05/23 01:21
--------创建表--------------
create   table    test_20151215   
(
   name   varchar2(20)


)


-------给表增加字段(增加性别,年龄两个字段)--
alter   table     test_20151215  add  (sex varchar2(10),age  number);


-------------给表增加说明(注释)-----------
comment   on   table   test_20151215  is '这是一张用户表'


-------给表字段增加注释---------------
comment  on  column   test_20151215.name  is '用户姓名';


comment   on  column   test_20151215.sex  is  '性别';


comment   on   column    test_20151215.age  is '年龄';


--------增加一个字段(descrition--自我介绍)--------------
alter  table   test_20151215 add (descrition  varchar2(500));
--添加字段注释
comment  on  column  test_20151215.descrition  is  '自我介绍';


----------改变字段长度(把descrition的长度改为200)--------
alter   table   test_20151215  modify (descrition  varchar2(200));




----------删除表的一个字段(删除descrition)---------------------
alter  table  test_20151215   drop  column  descrition;




------表重命名------
 alter   table  test_20151215   rename  to  test_20151216;
 









0 0