5 Star 0 Fork 0

Hellstalol/CampusHelper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
scake_table.sql 8.47 KB
一键复制 编辑 原始数据 按行查看 历史
Githubit 提交于 2016-07-27 11:28 . 课件表做了调整
create database scake default charset utf8;
use scake;
#校区表
create table campus (
id int(10) unsigned not null auto_increment comment '校区号',
nname varchar(255) not null comment '校区名',
primary key (id)
);
#院表
create table college (
id int(10) unsigned not null auto_increment comment '院号',
nname varchar(255) not null comment '院名',
cam_id int(10) unsigned default null comment '校区号',
primary key (id),
foreign key (cam_id) references campus (id)
);
#系表
create table department (
id int(10) unsigned not null auto_increment comment '系号',
nname varchar(255) not null comment '系名',
col_id int(10) unsigned comment '院号',
primary key (id),
foreign key (col_id) references college (id)
);
#专业表
create table major (
id int(10) unsigned not null auto_increment comment '专业号',
nname varchar(255) not null comment '专业名',
de_id int(10) unsigned default null comment '系号',
primary key (id),
foreign key (de_id) references department (id)
);
#学生资料表
create table student (
id varchar(255) not null comment '学生号',
nname varchar(255) not null comment '学生姓名',
icon varchar(255) not null comment '学生头像',
nickname varchar(255) default null comment '学生昵称',
ma_id int(10) unsigned not null comment '学生所属专业号',
grade varchar(255) not null comment '学生所属年级',
primary key (id),
foreign key (ma_id) references major (id)
);
#学生登录表
create table stu_login(
stu_id varchar(255) not null comment '学生号',
passw varchar(255) not null comment '学生密码',
primary key (stu_id),
foreign key (stu_id) references student (id)
);
#教师资料表
create table teacher (
id varchar(255) not null comment '教师号',
nname varchar(255) not null comment '教师姓名',
icon varchar(255) not null comment '教师头像',
de_id int(10) unsigned not null comment '教师所属系',
primary key (id),
foreign key (de_id) references department (id)
);
#教师登录表
create table tea_login(
tea_id varchar(255) not null comment '教师号',
passw varchar(255) not null comment '教师密码',
primary key (tea_id),
foreign key (tea_id) references teacher (id)
);
#教师联系方式表
create table tea_contacts(
tea_id varchar(255) not null comment '教师号',
tel varchar(255) not null comment '教师手机号',
email varchar(255) not null comment '教师邮箱(或QQ)',
address varchar(255) not null comment '教师办公室地址',
foreign key (tea_id) references teacher (id)
);
#教师云盘表
create table tea_cloud(
tea_id varchar(255) not null comment '教师号',
capacity float default null comment '教师云盘容量',
foreign key (tea_id) references teacher (id)
);
#二者关联表(教师——专业)
create table tea2ma(
tea_id varchar(255) not null comment '教师号',
ma_id int(10) unsigned not null comment '专业号',
grade varchar(255) not null comment '年级 (----新增----)',
foreign key (tea_id) references teacher (id),
foreign key (ma_id) references major (id)
);
#课程信息表
create table course(
id int(10) unsigned not null auto_increment comment '课程号',
nname varchar(255) not null comment '课程名',
primary key (id)
);
#课程时间表
create table course_time(
cou_id int(10) unsigned default null comment '课程号',
ttime varchar(255) not null comment '上课时间',
room varchar(255) default null comment '上课地点',
special varchar(255) default null comment '单双周',
ma_id int(10) unsigned default null comment '专业号',
grade varchar(255) not null comment '课程年级 (----新增----)',
foreign key (cou_id) references course (id),
foreign key (ma_id) references major (id)
);
#二者关联表(课程——教师)
create table cou2tea(
tea_id varchar(255) not null comment '教师号',
cou_id int(10) unsigned default null comment '课程号',
foreign key (tea_id) references teacher (id),
foreign key (cou_id) references course (id)
);
#二者关联表(课程——学生)
create table cou2stu(
stu_id varchar(255) not null comment '学生号',
cou_id int(10) unsigned default null comment '课程号',
foreign key (stu_id) references student (id),
foreign key (cou_id) references course (id)
);
#课件信息表
create table files(
id int(10) unsigned not null auto_increment comment '课件号',
nname varchar(255) not null comment '课件名',
url varchar(255) default null comment '课件地址',
ttime timestamp default current_timestamp comment '上传时间',
remark varchar(255) comment '备注',
primary key (id)
);
#二者关联表(专业——课件)
create table major2files(
f_id int(10) unsigned not null auto_increment comment '课件号',
major_id int(8) unsigned not null comment '课件专业',
stu_grade varchar(255) not null comment '课件年级',
foreign key (f_id) references files (id),
foreign key (ma_id) references major (id)
);
#二者关联表(教师——课件)
create table tea2files(
tea_id varchar(255) not null comment '教师号',
f_id int(10) unsigned comment '课件号',
foreign key (tea_id) references teacher (id),
foreign key (f_id) references files (id)
);
#讨论组表
create table discussion_group(
id int(10) unsigned auto_increment comment '讨论组号',
nname varchar(255) not null comment '讨论组名',
primary key (id)
);
#二者关联表(讨论组——学生)
create table dis2stu(
g_id int(10) unsigned comment '讨论组号',
stu_id varchar(255) not null comment '学生号',
foreign key (g_id) references discussion_group (id),
foreign key (stu_id) references student (id)
);
#二者关联表(讨论组——教师)
create table dis2tea(
g_id int(10) unsigned comment '讨论组号',
tea_id varchar(255) not null comment '教师号',
foreign key (g_id) references discussion_group (id),
foreign key (tea_id) references teacher (id)
);
#失物表
create table lost_message(
id int(10) unsigned auto_increment comment '失物帖子号',
stu_id varchar(255) not null comment '发帖人',
ttype varchar(255) not null comment '失物帖子类型',
tel varchar(255) not null comment '联系电话',
pic varchar(255) comment '失物图片',
detail varchar(255) not null comment '失物描述',
ttime timestamp default current_timestamp comment '发送时间',
primary key (id),
foreign key (stu_id) references student (id)
);
#失物历史消息表
create table lost_chat(
p_id int(10) unsigned comment '失物帖号',
stu_id varchar(255) not null comment '评论人号',
chat varchar(2550) not null comment '失物帖单条聊天记录',
ttime timestamp default current_timestamp comment '发送时间',
foreign key (p_id) references lost_message (id),
foreign key (stu_id) references student (id)
);
#校园新闻表
create table news(
id int(10) unsigned auto_increment comment '校园新闻号',
pic varchar(255) not null comment '校园新闻图片',
primary key (id)
);
#社团表
create table team(
id int(10) unsigned comment '社团号',
nname varchar(255) not null comment '社团名字',
icon varchar(255) not null comment '社团头像',
ttype varchar(255) not null comment '社团类型',
primary key (id)
);
#社团登录表
create table team_login(
team_id int(10) unsigned not null comment '社团号',
passw varchar(255) not null comment '社团密码',
primary key (team_id),
foreign key (team_id) references team (id)
);
#二者关联表(社团——新闻)
create table team2news(
team_id int(10) unsigned comment '社团号',
n_id int(10) unsigned comment '校园新闻号',
foreign key (team_id) references team (id),
foreign key (n_id) references news (id)
);
#讨论组历史消息表
create table dis_chat(
g_id int(10) unsigned comment '讨论组号',
pull varchar(255) not null comment '发布人号',
chat varchar(2550) not null comment '讨论组单条聊天记录',
ttime timestamp default current_timestamp comment '发送时间',
foreign key (g_id) references discussion_group (id)
);
#群历史消息表
create table cou_chat(
cou_id int unsigned comment '课程号',
pull varchar(255) not null comment '发布人号',
chat varchar(2550) not null comment '群单条聊天记录',
ttime timestamp default current_timestamp comment '发送时间',
major_id int(8) not null comment '群专业 (----新增----)',
grade varchar(255) not null comment '群年级 (----新增----)',
foreign key (cou_id) references course (id)
);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hellstalol/CampusHelper.git
git@gitee.com:hellstalol/CampusHelper.git
hellstalol
CampusHelper
CampusHelper
master

搜索帮助