新建表:
create table 表名(
字段1 类型(长度) primary key,--主键
字段1 类型(长度) not null --不为空
);
删除表:
drop table 表名;
清空表:
truncate table 表名;
delete from 表名 where 条件;
添加表字段:
alter table 表名 add 字段名 类型(长度)
default ‘默认内容’ not null; --不为空添加此段
删除表字段:
alertr table 表名 drop column 字段名;
修改字段类型:
alertr table 表名 alter column 字段名 新类型;
用户授权:
GRANT SELECT --查询条件可更换update、delete
ON 数据库名.表名 --已有权限的表名
TO 数据库名; --需要授权的
--授予用户dba权限
grant imp_full_database --dba权限
to k2glsdb_pl_u_a01; --需要授权用户
查询数据为空则返回执行值:
select nvl(字段,指定值) --如果字段为空则返回指定值
from 表名;
对查询结果进行截取:
select substr(字段,开始位置,截取长度) --开始位置从1开始
from 表名;