Oracle基础-数据表
Reading Time:The full text has 163 words, estimated reading time: 1 minutes
Creation Date:2017-07-21
Previous Article:Python模块学习1-csv
Next Article:Oracle基础-表空间
BEGIN
- 创建表
create table tb_name(
id number(1000, 0),
haha varchar2(500),
create_at date
)
- 增加字段:
alter table tb_name add col_name varchar2(500);
- 修改字段:
alter table tb_name modify col_name varchar2(50);
- 删除字段:
alter table tb_name drop column col_name;
- 字段改名:
alter table tb_name rename column col_name to col_name_new;
- 表改名:
rename tb_name to tb_name_new;
- 清除表数据1:
delete from tb_name;
- 清除表数据2:
truncase table tb_name;
删除速度比delete快很多,在citusdata中用来清除表及和此表所有关联表的内容。 - 复制表数据:
--1.建表时复制
create table tb_name as
select * from tb_name_oragin;
--2.建表后复制
insert into tb_name(id)
select id from tb_name_oragin;
- 更新数据:
update tb_name
set col_name = value
where 条件;
- 删除数据:
delete from tb_name where 条件;
FINISH
Previous Article:Python模块学习1-csv
Next Article:Oracle基础-表空间