Oracle 的DDL 和 DML 操作

 create table  表名( fieldname  数据类型(长度)[ primary key / not null ],

                  fieldname1  数据类型(长度)[ not null ],

                 fieldname2  数据类型(长度)[ not null ]   );

注意:最后一个字段的后面不要标点   

INSERT INTO 表(字段) values(....)


delete from 表 可以回滚 rollback

清空表数据
truncate table 表 不可回滚 not rollback

创建已有的表的部分字段为新表
create table 表名 as select 字段  from 已有的表
 
增加表列
alter table 表名 add (列名 类型(长度),...)
修改列的类型及尺寸默认值
alter table 表名 modify (列名 类型(长度),...)[default ...]
修改表的名字
alter table 表名 rename to 新表名
修改列的名字
alter table 表名 rename column 原始列名 to 新列名
删除某一列
alter table 表名 drop column 列名

删除表
drop table 表名

以上案例就参考下面的Blog吧,事情有点多,没法一 一列出,见谅!!

第2个blog 写的很清楚

 参考Blog:

https://blog.csdn.net/k_young1997/article/details/79703878

https://www.cnblogs.com/qmfsun/p/3817344.html

猜你喜欢

转载自blog.csdn.net/qq_16116183/article/details/82846593