35665-vm/db/migrations/005_create_exam_results_table.sql
2025-11-12 15:23:26 +00:00

10 lines
355 B
SQL

CREATE TABLE IF NOT EXISTS exam_results (
id INT AUTO_INCREMENT PRIMARY KEY,
exam_id INT NOT NULL,
user_id INT NOT NULL,
score DECIMAL(5, 2) NOT NULL,
submitted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (exam_id) REFERENCES exams(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);