DataBase project physical design

本文详细介绍了数据库物理设计中涉及的学生信息、课程、任务及个人信息等表的创建与使用。包括学生表、课程表、任务表和个人信息表的具体字段定义。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

DataBase physical design

//Table:
/*student*/
create table student(
    id int not null primary key,    /*学号*/
    name varchar(20) not null,      /*姓名*/
    college varchar(20) not null,   /*学院*/
    grade int not null,             /*年级*/
    gender varchar(6) not null,     /*性别*/
    age int not null                /*年龄*/
);

Table student(学生信息)

idnamecollegegradegenderage
14001pualCSjuniormale20
14002aliceADjunjorfemele21

可按上述表格形式插入

/*study*/
create table curriculum(
    s_id int not null,  /*学号*/
    c_id int not null   /*课程号*/
        constraint c_id_fk foreign key (c_id) references course(c_id)
);

Table curriculum(课表)

s_idc_id
140019001
140019002
140029001
140029003
140039004
/*study*/
create table course(
    c_id int not null constraint primary key,   /*课程号*/
    teacher varchar(20) not null,   /*老师*/
    credit int not null,            /*学分*/
    signed int not null,            /*签到率*/
    c_difficulty int not null       /*课程难度*/
);

Table course

c_idc_nameteachersigned(10)c_difficulty(10)
9001DataBaseDr.Guan JiHong108
9002Computer GraphicDr.Zhao Junqiao09
9003Computer ArchitectureDr.Qin Guofeng98
9004Operate SystemDr.Fang Yu08.5
/*do*/
create table task(
    t_id varchar(7) not null constraint primary key,/*作业号(任务创立日期+编号)*/
                                                    /* 格式: Year+M + D  + number
                                                       e.g  7 + 12 + 16 + 02 */
    t_course int constraint t_c_fk 
        foreign key references course(c_id),    /*作业所属课程*/
    t_deadline datetime,                /*20161210 最后期限*/
    t_detail varchar(20),               /*详情*/
    t_amount int not null,              /*1.2.3.4.5 作业数量*/
    t_difficulty int not null           /*1.2.3.4.5 作业难度*/
);

Table task

t_idt_courset_deadlinet_detailt_amount(10)t_difficulty(10)
612160190012016-12-20 23:59:59P232,2/3/537
290022017-01-09 23:59:59Assignment329
create table message(
    m_id int not null constraint primary key,/*信息号(任务创立日期+编号)
                                               格式: Year+M + D  + number
                                               e.g  7 + 12 + 16 + 02   */
    type varchar(10) not null,      /*
                                    信息类型:
                                    娱乐(entertainment)
                                    兴趣(interest)
                                    工作(job)
                                    学习(study)
                                    信仰(faith)
                                    */
    details varchar(30),            /*详情*/
    m_deadline datetime,            /*最后期限*/
    duration datetime,              /*持续时间*/
    Emergency_index int not null    /*1.2.3.4.5 紧急程度*/
);

Table message

m_idtypedetailsStartEndEmergency_index(10)
6120201interestplay piano2016-12-12 17:30:002016-12-12-17:59:599
6120201faithgo to the YangPu church2016-12-12 17:30:002016-12-12-17:59:599
/*live*/
create table birthday(
    f_name varchar(20) not null constraint primary key, /*姓名*/
    relation varchar(10) not null,  /*关系*/
    current_age int not null,       /*当前年龄*/
    f_gender varchar(6) not null,   /*性别*/
    f_birthdat datetime not null,   /*生日*/
    gift varchar(1) not null        /*是否需要礼物*/
);
f_namerelationcurrent_agef_genderf_birthdaygift(Y/N)
BobFaother34male2017-09-17 00:00:00Y
Alicesister23female2017-02-13 00:00:00Y
Judyfriend20female2017-02-22 00:00:00Y

以学号建立索引
生日表以姓名建立索引

转载于:https://www.cnblogs.com/pualus/p/6188319.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值