desc 表名;查看表的结构
改表名:
RENAME student to studentl;
rename studentl to student;
加列:
alter table 表名
add 新加列的名 数据类型 null设定(null\not null);
alter table student
add sgender char(1);
(注:直接添加的列时不可直接设定为not null,应先添加可为空的列,为每一个记录添加此字段值后,再改为不可为空)
更改表的数据类型:
alter table 表名
modify 字段名 新类型;
alter table student
modify sname varchar2(40);
(注:可同类型的加宽长度,但对有值的字段修改类型或缩小长度会出错,只能修改全为控制的列)
更改空值选项:
alter table student
modify sname not noll;
(注:修改not null 的字段不能有空值)
修改字段名:(没有价值)
流程:新建一个表,与原表只有想修改的字段的名字不同,把原表值给到新表,删除旧表,改新表名为旧表名。