zoukankan      html  css  js  c++  java
  • Python全栈之路-MySQL(二)

    MySQL实践

    create table class (              
    cid int not null auto_increment primary key,              
    caption char(20) not null
    )engine=innodb default charset=utf8;
    
    
    create table student (              
    sid int not null auto_increment primary key,              
    sname char(20) not null,
    gender char(1) not null,
    class_id int not null,
    constraint fk_student_class foreign key (class_id) references class(cid)
    )engine=innodb default charset=utf8;
    
    create table teacher (              
    tid int not null auto_increment primary key,              
    tname char(20) not null
    )engine=innodb default charset=utf8;
    
    create table course (              
    cid int not null auto_increment primary key,              
    cname char(20) not null,
    teacher_id int not null,
    constraint fk_course_teacher foreign key (teacher_id) references teacher(tid)
    )engine=innodb default charset=utf8;
    
    create table score (              
    sid int not null auto_increment primary key,              
    student_id int not null,
    course_id int not null,
    number int not null,
    constraint fk_score_student foreign key (student_id) references student(sid),
    constraint fk_score_course foreign key (course_id) references course(cid)
    )engine=innodb default charset=utf8;
    
    
    
    
    insert into class(caption) values('三年二班'),('一年三班'),('三年一班');
    
    insert into student(sname,gender,class_id) values('钢蛋','女',1),('铁锤','铁锤',1),('山炮','男',2);
    
    
    insert into teacher(tname) values('波多'),('苍空'),('饭岛');
    
    insert into course(cname,teacher_id) values('生物',1),('体育',1),('物理',2);
    
    insert into score(student_id,course_id,number) values(1,1,60),(1,2,59),(2,2,100);
    
    
  • 相关阅读:
    拉普拉斯矩阵
    正定矩阵 和 半正定矩阵
    Random Walk
    论文解读(DGI)《DEEP GRAPH INFOMAX》
    python安装easyinstall/pip出错
    pip国内源设置
    在Jupyter Notebook添加代码自动补全功能
    [BUUCTF]PWN——bjdctf_2020_babystack2
    [BUUCTF]REVERSE——[BJDCTF 2nd]8086
    [BUUCTF]PWN——jarvisoj_tell_me_something
  • 原文地址:https://www.cnblogs.com/wanyuetian/p/6946009.html
Copyright © 2011-2022 走看看