add sql file

main
fzu062200129 6 months ago
parent 3ef1990518
commit b9c9cc98c9

@ -0,0 +1,21 @@
-- 学生表
CREATE TABLE students (
id INT PRIMARY KEY AUTO_INCREMENT,
student_id VARCHAR(20) UNIQUE NOT NULL, -- 学号
name VARCHAR(50) NOT NULL, -- 姓名
major VARCHAR(100) NOT NULL, -- 专业
score FLOAT DEFAULT 0, -- 积分
random_count INT DEFAULT 0, -- 随机点名次数
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- 点名记录表
CREATE TABLE attendance (
id INT PRIMARY KEY AUTO_INCREMENT,
student_id VARCHAR(20) NOT NULL, -- 关联学生学号
attendance_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- 点名时间
status ENUM('present', 'absent') DEFAULT 'present', -- 出勤状态
answer_score FLOAT DEFAULT 0, -- 回答问题得分0.5~3或-1
mode ENUM('random', 'order') NOT NULL, -- 点名模式
FOREIGN KEY (student_id) REFERENCES students(student_id)
);
Loading…
Cancel
Save