目标
    1.MySQL 服务处于运行状态

    2.新建数据库的名称为 gradesystem

    3.gradesystem 包含三个表:student、course、mark;

    student 表包含3列:sid(主键)、sname、gender;
    course 表包含2列:cid(主键)、cname;
    mark 表包含4列:mid(主键)、sid、cid、score ,注意与其他两个表主键之间的关系。

create table student
    -> (
    -> sid int(10)primary key AUTO_INCREMENT,
    -> snmae char(20)not null,
    -> gender char(10)not null
    ->);

 

create table course
    -> (
    -> cid int(10)primary key AUTO_INCREMENT,
    -> cname char(20)not null);

 

create table mark
    -> (
    -> mid int(10)primary key AUTO_INCREMENT,
    -> sid int(10),
    -> foreign key(sid) references student(sid),
    -> cid int(10),
    -> foreign key(cid) references course(cid),
    -> score int(10));

 

相关文章:

  • 2021-12-14
  • 2021-08-03
  • 2021-06-06
  • 2021-09-17
  • 2021-06-23
  • 2021-10-19
  • 2021-12-15
猜你喜欢
  • 2021-10-13
  • 2021-11-27
  • 2021-08-03
  • 2022-03-01
  • 2021-04-02
  • 2022-01-20
  • 2021-07-20
相关资源
相似解决方案