表的创建与删除
删除表命令:
drop table if 表名 is exists;
创建表命令:
create table 表名(
字段名 字段类型 默认值 描述);
-- ---------------
-- 创建学生表
-- ---------------
drop table if student is exists;
create table student(
sno bigint(20) not null auto_increment comment '学号',
sname varchar(64) default null comment '姓名',
sage int(10) default 0 comment '年龄',
ssex char(2) default '男' comment '性别',
sdpt int(10) default 0 comment '系号',
primary key(sno)
)engine=innodb auto_increment=200 commnet='部门表';
-- -------------
-- 创建系表
-- --------------
drop table if dpt is exists;
create table dpt(
dno bigint(20) not null auto_increment comment '系号',
dname varchar(30) default null comment '系名',
primary key(dno)
)engine=innodb auto_increment comment '系表';