Oracle 对表的基本CURD操作!

Oracle对表的基本Curd操作:

样式表:接下来对这张(表明:Stud)表进行Curd操作(请看面SQL代码)

    

1):增加新的字段列:

alter table Stud add(height varchar2(100))       
--解释:alter table 表名称 add(字段名 字段类型  默认值 是否为空);--此出的默认值 是否为空可省略不写        关键字:add

 

2):修改字段的类型:

alter table Stud modify(height number(4))     
--解释:alter table 表名称 modify (字段名 字段类型  默认值 是否为空);--此出的默认值 是否为空可省略不写   关键字:modify

3):修改字段名称:

alter table Stud rename column height to gao  
--解释: alter table 表名称 rename column 想要修改的列名称 to 列的新名称         关键字: rename column  * to *

4):删除表中多余的列:

alter table Stud drop column gao     
--解释:alter table 表明称 drop column 不想要的列                             关键字:drop column

5):修改表的的名称:

alter table Stud rename to xuesheng (不会破坏表的结构和字段类型及其内容)    关键:注意表明称不要写反
--解释:alter table 原表名称 rename to 改后的表明

生在内卷,你卷我也卷。 愿与诸君共勉!
原文地址:https://www.cnblogs.com/superyonng/p/13268466.html