mybatis学习篇

mybatis学习笔记(深入浅出mybatis技术原理与实战)

以下是mybatis的数据库表sql.之后的学习都以这几张表为基础了

Drop table if exists t_role;
Drop table if exists t_user;
Drop table if exists t_user_role;
Drop table if exists t_lecture;
Drop table if exists t_lecture;
Drop table if exists t_student;
Drop table if exists t_student_health_female;
Drop table if exists t_student_health_male;
Drop table if exists t_student_lecture;
Drop table if exists t_student_selfcard;

Create table t_role (
id int(20) not null auto_increment comment ‘编号’,
role_name varchar(60) not null comment ‘角色名称’,
note varchar(1024) default null comment ‘备注’,
primary key (id)
) engine=innodb default charset=utf8;

Create table t_user (
id bigint(20) not null auto_increment comment ‘编号’,
user_name varchar(60) not null comment ‘用户名称’,
cnname varchar(60) not null comment ‘姓名’,
sex tinyint(3) not null comment ‘性别’,
mobile varchar(20) not null comment ‘手机号码’,
email varchar(60) default null comment ‘电子邮箱’,
note varchar(1024) default null comment ‘备注’,
primary key (id)
) engine=innodb default charset=utf8;

Create table t_user_role (
user_id bigint(20) not null comment ‘用户编号’,
role_id int(20) not null comment ‘角色编号’,
primary key (user_id,role_id)
);
Alter table t_user_role add constraint fk_reference_1 foreign key (user_id)
References t_user (id) on delete restrict on update restrict;
Alter table t_user_role add constraint fk_reference_2 foreign key (role_id)
References t_role (id) on delete restrict on update restrict;

Create table t_lecture(
id int (20) not null auto_increment comment ‘编号’,
lecture_name varchar (60) not null comment ‘课程名称’,
note varchar (1024) comment ‘备注’,
primary key (id)
);

Create table t_student (
id int (20) not null auto_increment comment ‘编号’,
cnname varchar (60) not null comment ‘学生姓名’,
sex tinyint (4) not null comment ‘性别’,
selfcard_no int (20) not null comment ‘学生证号’,
note varchar (1024) comment ‘备注’,
primary key (id)
);

Create table t_student_health_female(
id int (20) not null auto_increment comment ‘编号’,
student_id varchar(60) not null comment ‘学生编号’,
check_date varchar(60) not null comment ‘检查日期’,
heart varchar (60) not null comment ‘心’,
liver varchar (60) not null comment ‘肝’,
spleen varchar (60) not null comment ‘脾’,
lung varchar (60) not null comment ‘肺’,
kidney varchar (60) not null comment ‘肾’,
uterus varchar (60) not null comment ‘子宫’,
note varchar (1024) null comment ‘备注’,
primary key (id)
);

Create table t_student_health_male(
id int (20) not null auto_increment comment ‘编号’,
student_id varchar(60) not null comment ‘学生编号’,
check_date varchar(60) not null comment ‘检查日期’,
heart varchar (60) not null comment ‘心’,
liver varchar (60) not null comment ‘肝’,
spleen varchar (60) not null comment ‘脾’,
lung varchar (60) not null comment ‘肺’,
kidney varchar (60) not null comment ‘肾’,
prostate varchar (60) not null comment ‘前列腺’,
note varchar (1024) null comment ‘备注’,
primary key (id)
);

Create table t_student_lecture(
id int(20) not null auto_increment comment ‘编号’,
student_id int(20) not null comment ‘学生编号’,
lecture_id int(20) not null comment ‘课程编号’,
grade decimal(16,2) not null comment ‘评分’,
note varchar(1024) comment ‘备注’,
primary key(id)
);

Create table t_student_selfcard(
id int(20) not null auto_increment comment ‘编号’,
student_id int (20) not null comment ‘学生编号’,
native varchar (60) not null comment ‘籍贯’,
issue_date date not null comment ‘发证日期’,
end_date date not null comment ‘结束日期’,
note varchar (1024) comment ‘备注’,
primary key (id)
);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值