re: The use cases and benefits of a RDBMS VIEW POST


This sql script will enforce that, when you want to insert new user into your database, it must not contain duplicate email. No need in your code to enforce this.

It's advisable to do this in your code as well, so you can tell the user "This email has already been used". Otherwise, a database exception will be thrown with a message like "Integrity constraint violation", which you can't show to your users and you can't act on.


Ah, i see your point. In my case, i would just catch the piece of code and handle it like you said and return nice error message to the call site.

code of conduct - report abuse