设计表:多张表存储学生成绩及各种信息

作业设计表:多张表存储学生成绩及各种信息

需要从表里面体现:

关于学生的:代号 姓名 性别 年龄 班级

关于课程的:代号 名称

关于老师的:代号 姓名

关于成绩的:例如:闫超--网页--90

  1. 要能查看学生,课程,老师,成绩的信息

  2. 能根据学生代号和课程代号看到成绩

  3. 能根据学生代号找到带课老师

  4. 通过excel表设计

 

  5. 标清楚列名,类型,长度,备注和关系

这是用escel做的

 

 

下面是用代码写的

create table class
(
code varchar(20) primary key,
name varchar(20) 

);

create table kecheng
(
code varchar(20) primary key,
name varchar(20) 

);


create table teacher
(
code varchar(20) primary key,
name varchar(20) 

);


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

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

create table chengji
(
    isd int auto_increment primary key,
    scode varchar(20),
    kcode varchar(20),
    degree float,
    foreign key (scode) references student(code),
    foreign key (kcode) references kecheng(code)

);

 

转载于:https://www.cnblogs.com/sq45711478/p/5966108.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值