🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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)?

  1. A.To make queries faster only
  2. B.JPA requires it for @ManyToOne
  3. C.As a database safety net so a second enrolment of the same student in the same course is refused
  4. 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 →