学生信息数据库(stusys)的表结构的样本数据

学生信息数据库(stusysy)中的表——学生表(student)、课程表(course)、成绩表(score)、教师表(teacher)、讲课表(lecture)的表结构和样本数据,介绍如下d2d52cfb3a8f440d8244b9a07b1dfaf5.png

10c2664d56c646f686e5dc8180c7d542.png 

 

实现代码如下:

create database stusys; 
use stusys;
create table student
(
    sno varchar(6) not null primary key comment '学号',
    sname varchar(8) not null comment '姓名',
    ssex varchar(2) not null default '男' comment '性别',
    sbirthday date not null comment '出生日期',
    speciality varchar(12) null comment '专业',
    tc tinyint null comment '总学分'
);
create table course
(
    cno varchar(4) not null primary key comment '课程号',
    cname varchar(16) not null comment '课程名',
    credit tinyint null comment '学分'
);
create table score
(
    sno varchar(6) not null comment '学号',
    cno varchar(4) not null  comment '课程号',                                                     
    grade tinyint null comment '成绩',
    primary key(sno,cno)
);
create table teacher
(
    tno varchar(6) not null primary key comment '教师编号',
    tname varchar(8) not null comment '姓名',
    tsex varchar(2) not null comment '性别',
    tbirthday date not null comment '出生日期',
    title varchar(12) null comment '职称',
    school varchar(12) null comment '学院'
);
create table lecture
(
    tno varchar(6) not null comment '教师编号',
    cno varchar(4) not null comment '课程号',
    location varchar(10) null comment '上课地点',
    primary key(tno,cno)
);
use stusys;
insert into student
    values
        ('191001','刘清泉','男','1998-06-21','计算机',52),
        ('191002','张慧玲','女','1999-11-07','计算机',50),
        ('191003','冯涛','男','1999-08-12','计算机',52),
        ('196001','董明霞','女','1999-05-02','通信',50),
        ('196002','李茜','女','1998-07-25','通信',48),
        ('196004','周俊文','男','1998-03-10','通信',52);
        
insert into course
    values
        ('1004','数据库系统',4),
        ('1017','操作系统',4),
        ('4002','数字电路',4),
        ('8001','高等数学',4),
        ('1201','英语',4);

insert into score
    values
    ('191001','1004',95),
    ('191002','1004',87),
    ('191003','1004',93),
    ('196001','4002',90),
    ('196002','4002',79),
    ('196004','4002',88),
    ('191001','8001',92),
    ('191002','8001',88),
    ('191003','8001',84),
    ('196001','8001',87),
    ('196002','8001',null),
    ('196004','8001',94),
    ('191001','1201',92),
    ('191002','1201',78),
    ('191003','1201',93),
    ('196001','1201',84),
    ('196002','1201',76),
    ('196004','1201',92);
    
    insert into teacher
        values
        ('100006','何艺杰','男','1970-06-23','教授','计算机学院'),
        ('100023','孙浩然','男','1979-04-09','教授','计算机学院'),
        ('400017','李亚兰','女','1988-11-04','讲师','通信学院'),
        ('800028','袁万明','男','1978-08-15','副教授','数学学院'),
        ('120046','刘硕','女','1976-12-25','副教授','外国语学院');
    
    insert into lecture
        values
        ('100006','1004','2-311'),
        ('400017','4002','1-106'),
        ('800028','8001','6-104'),
        ('120046','1201','6-215');
    

运行结构成功截图如下:

b546a379c2e349b59879cefdd2cbf6dd.png

 0bed442d027d45d2ba7a0cd8f06ab994.png

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

冯阳xx

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值