如果需要代码请评论区留言或私信
create table Adminuser(
username int unsigned primary key not null auto_increment,
password varchar(16) default '123456'
);
create table Studentuser(
username int unsigned primary key not null auto_increment,
password varchar(16) default '123456'
);
create table teacheruser(
username int unsigned primary key not null auto_increment,
password varchar(16) default '123456'
);
create table teacher(
job_num int unsigned primary key auto_increment,
t_name varchar(20) not null,
college varchar(20) not null
);
create table student(
stu_num int unsigned primary key auto_increment,
stu_name varchar(20) not null,
sex varchar(1) not null,
age tinyint unsigned not null,
class varchar(20) not null,
major varchar(20) not null,
credit int(5) unsigned not null default 0
);
create table course(
c_num int unsigned primary key auto_increment,
t_num int unsigned not null,
c_name varchar(20) not null,
c_credit tinyint unsigned not null,
constraint c_t_num foreign key(t_num) references teacher(job_num)
);
create table select_course(
stu_num int unsigned ,
c_num int unsigned not null,
s_score float(5,2) not null,
primary key(stu_num,c_num),
foreign key(stu_num) references student(stu_num),
foreign key(c_num) references course(c_num)
);
--统计及格人数
delimiter $
CREATE PROCEDURE passnumber(in c_id int unsigned)
begin
select sum(case when s_score>=60 then 1 else 0 end) as 及格人数,
sum(case when s_score<60 then 1 else 0 end) as 不及格人数
from score where c_num=c_id;
end $
delimiter ;
登录界面
学生界面
教师界面
管理员界面