Sql表的创建和删除

表的创建与删除

删除表命令:

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 '系表';
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值