mysql 使用示例

create database springboot;

use springboot;

create table department(

        id int(10) not null auto_increment primary key,     主键设置

        departmentName varchar(200) not null

)ENGINE=INNODB DEFAULT CHARSET=utf8;

create table employee(

        id int(10) not null auto_increment primary key,

        lassName varchar(200) not null,

        email varchar(200),

        gender int(1),

        departmentId int(10),

        foreign key(departmentId) references department(id),       //外键设置

        brith datetime                     datetime 格式为  yyyy-MM-dd HH:mm:ss

)engine=innodb default charset=utf8;

猜你喜欢

转载自blog.csdn.net/qq_40197728/article/details/119758715