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 ;