Orcle基础知识(DDL)

DDL操作

create/drop/truncate/alter

1.创建表creat

 create table mytab6 
(
   id  number ,
   name varchar(10),
   age number
);

注意事项:
1.权限和空间问题
2.表名的规定:
a.必须以字母开头
b.表名只能包含: 大小写字母、数字、_、KaTeX parse error: Expected 'EOF', got '#' at position 2: 、#̲ c.长度 1-30个字…reserved_words order by keyword asc ;

设置某个字段的宽度:
字符
	col KEYWORD for a10
数字
	col  LENGTH for 9999

2.修改表alter

a.追加新列

alter table mytab6 add myother varchar2(10) ;

b.修改列

//修改列的长度
alter table mytab6 modify  myother varchar2(20) ;
//修改列的类型
alter table mytab6 modify  myother number ;

注意: blob/clob不能修改 ->先删除此列,重新追加
alter table mytab6 add myother2 blob ;
alter table mytab6 modify myother2 number ;//失败

c删除列

alter table mytab6 drop column myother2 ;

d重命名列

alter table mytab6 rename column myother to myother3 ;

3.删除表drop

//-->放在了回收站
drop table mytab6;  
// 表以及回收站中的表
select *from tab;

查看回收站 show recyclebin;
清空回收站 purge recyclebin;
还原回收站 闪回

删除表 并清空:

drop table test02 purge ;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值