一个简单的mysql建库脚本

create database springtest;
use springtest;

drop table if exists  student;
create table student(
    id int auto_increment primary key,
    username varchar(100) not null comment "用户名",
    telephone varchar(11) comment "电话号码",
    myclassid int comment "所属班级id"

)ENGINE = InnoDB auto_increment=10 charset = utf8;

create table myclass(
    id int auto_increment primary key,
    classname varchar(100) not null,
    headmasterid int

)ENGINE = InnoDB auto_increment=0 charset = utf8;

create table headmaster(
    id int auto_increment primary key,
    mastername varchar(100) not null,
    telephone varchar(11)
)ENGINE= InnoDB auto_increment=0 charset = utf8;

create table course(
    id int auto_increment primary key,
    coursename varchar(100) not null

)ENGINE = InnoDB auto_increment=0 charset = utf8;

create table courseStudent(
    courseStudentid int,
    studentid int
)ENGINE =  InnoDB auto_increment=0 charset = utf8;
文章目录
|