idea中的目录:
CREATE TABLE `blog`(
`id` VARCHAR(50) not null COMMENT '博客id',
`title` VARCHAR(100) not null COMMENT '博客标题',
`author` VARCHAR(30) not null COMMENT '博客作者',
`creat_time` datetime not null COMMENT '创建时间',
`views` int(30) not null COMMENT '浏览量'
)ENGINE=INNODB DEFAULT CHARSET=utf8
CREATE TABLE `teacher`(
`id` int(10) not NULL,
`NAME` VARCHAR(30) DEFAULT null,
PRIMARY KEY (`id`)
)ENGINE=INNODB DEFAULT CHARSET=utf8
insert into teacher(`id`,`name`) values (1,'秦老师');
CREATE TABLE `student`(
`id` int(10) not NULL,
`NAME` VARCHAR(30) DEFAULT null,
`tid` int(10) DEFAULT null,
PRIMARY KEY (`id`),
key `fktid` (`tid`),
CONSTRAINT `fktid` FOREIGN KEY(`tid`) REFERENCES `teacher` (`id`)
)ENGINE=INNODB DEFAULT CHARSEt=utf8
INSERT INTO `student` (`id`,`NAME`,`tid`) values
(1,'小明',1),
(2,'小红',1),
(3,'小张',1),
(4,'小李',1),
(5,'小王',1)
User表就看个图吧,都懂,代码忘记保存啦!