← Quiz: Relationships and Transactions: all 10 questions
Quiz: Relationships and Transactions · Question 10 of 10
Why does the Enrollment table also have a unique constraint on (student, course)?
Why does the Enrollment table also have a unique constraint on (student, course)?
- A.To make queries faster only
- B.JPA requires it for @ManyToOne
- C.As a database safety net so a second enrolment of the same student in the same course is refused
- D.To allow duplicates
Answer & explanation
Correct answer: As a database safety net so a second enrolment of the same student in the same course is refused
The database enforces the rule even if two requests pass the Java check together.
Can you get the rest right without peeking?
Take the timed Quiz: Relationships and Transactions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →