SQL代码创建表例子

时间:2023-03-09 05:49:51
SQL代码创建表例子

SQL代码创建表例子

create table class
(
    code ) primary Key,
    name )

);

SQL代码创建表例子

create table student
(
    code ) primary Key,
    name ),
    sex bit,
    age int,
    class ),
    foreign Key (class) references class(code)
);

SQL代码创建表例子

create table kecheng
(
    code ) primary Key,
    name )
);

SQL代码创建表例子

create table teacher
(
    code ) primary Key,
    name )
);

SQL代码创建表例子

create table chengji
(
    ids int auto_increment primary Key,
    scode ),
    kcode ),
    degree float,
    foreign Key (scode) references student(code),
    foreign Key (kcode) references kecheng(code)
);

SQL代码创建表例子

create table tkecheng
(
    ids int auto_increment primary Key,
    tcode ),
    kcode ),
    foreign Key (tcode) references teacher(code),
    foreign Key (kcode) references kecheng(code)
);