テーブルに一意の制約を追加します: ALTER TABLE yourtable ADD CONSTRAINT constraintname UNIQUE (student_id, subject, academic_period)