Databases · Middle · Question 43 of 75
Where should a 'unique email' rule be enforced?
- ✓Correct answer: In the database with a unique constraint (possibly on
lower(email)); an application check alone has a race condition - 2Only in the application, by checking before insert
- 3Only in the front end
Explanation
Two requests can both pass a 'does it exist?' check and insert duplicates. The constraint makes the database the final judge; handle its error in the app.