I have three tables in my ClassSelector DB:
students
student_id(P_key) | student_name | hometown
classes
class_id(P_key) | classname | description
student_x_class
student_id | class_id | classname
I am trying to enter students into classes, but prevent entering the same student twice in the same class. I tried INSERT IGNORE, but that blocked me from entering the same student in two different classes. I have no primary key in the student_x_class
table. Could I student_id
and class_id
primary keys?
I guess the real question is how do I make a unique value for two columns(Student_id
, class_id
)?