标签:def run UNC for 计数器 int 计数 engine utf8
alter table grade rename hang;
alter table grade add `name` varchar(100);
alter table grade modify `name` varchar(100);
alter table grade change `name` `name1` varchar(10);
alter table grade drop `name`;
alter table student
add constraint `FK_gradeID`
foreign key (`gradeID`) references `grade` (`id`);
drop table grade;
drop table if exists grade;
create table if not exists `student` ( `id` int(4) not null auto_increment comment ‘学号‘, `name` varchar(30) not null default ‘匿名‘ comment ‘名字‘, `pwd` varchar(20) not null default ‘123456‘ comment ‘密码‘, `birthday` datetime default null comment ‘出生日期‘, `address` varchar(100) default null comment ‘家庭住址‘, `email` varchar(50) default null comment ‘邮箱‘, `gradeID` int(10) comment ‘年级ID‘, primary key (`id`), key `FK_gradeID` (`gradeID`), constraint `FK_gradeID` foreign key (`gradeID`) references `grade` (`id`))ENGINE=InnoDB default charset = utf8;
create table if not exists `grade` ( `id` int(10) not null auto_increment comment ‘ID‘, `name` varchar(30) null comment ‘名称‘, primary key (`id`))ENGINE=InnoDB default charset = utf8;
truncate table `grade`;
都能删除数据,都不会删除表结构
truncate会重新设置自增列,计数器会归零
truncate不会影响事务
标签:def run UNC for 计数器 int 计数 engine utf8
原文地址:https://www.cnblogs.com/codesail/p/14831143.html