Unique relationship attribute for every pair of entities I have entities &quot;Student&quot; and &quot;Course&quot; and they are connected with relationship many-to-many called &quot;Exam&quot;. The relationship &quot;Exam&quot; has an atribute &quot;Grade&quot;. For this ER model, I have made a relational schema:
Student(StudentID, StudentName, DoB)
Course(CourseID, CourseName)
Exam(StudentID, CourseID, Grade)

Can someone explain how would you put in a relational schema the fact that a student can't get multiple grades for a single course? For example, we can't have records like (Student1, Course1, Grade1) and (Student1, Course1, Grade2).
You would create a unique constraint on exam (StudentId, CourseId) this would usually be achieved with a unique index on that table that covered the two columns.
Here's a quick demo in MySql