DDL - data definition language,数据定义语言,主要的命令有create,alter,drop等,主要作用有改变表结构等
- create
create table tstudent (
stu_id int,
stu_name char(10),
stu_sex char(2),
stu_age int);
- drop
drop table tstudent;
- alter
--添加字段
alter table tstudent add stu_join_date;
--修改字段
alter table tstudent modify(stu_name char(20));
alter table tstudent modify(stu_join_date timestamp);
--重命名字段
alter table tstudent rename column stu_join_date to stu_join_dt;
--删除字段
alter table tstudent drop column stu_age;
--重命名表
alter table tstudent rename to student;
网友评论