Understand responsibilities of database and backend Still learning, but there is something I can't understand.
Some features of MySQL seem (to me) to flow on the responsibilities of the backend.
In particular, I'm talking about data validation (excluding relations) for example NULL/UNIQUE.
Now, I'd like to know why this duplicate? Is it a second layer? More in general, in a good application, do I have to count on the errors raised by the DB as an organic part of the application, or should the application be designed to avoid those errors and only count on them as an extrema ratio?
An RDBMS is part of the backend, only in  rare cases such as access, you can have both.
Even so the GUI should always (try to) prevent errors in the database, and should control the input of its validity.
Errors happen, should not directly shown to the user. But as you have to debug it, you should show helpful ids or text, that could help fixing things.
For a qualified system you have to go a step further and tell the user how he can fix the problem, for example be editing his input in a correct way.
Check constraints help to debug your code, especially in the beginning, when the GUI is only starting, so no problem will be missed.
Foriegn keys, triggers and events help the database maintaining or do things that the user has no influence over, since the RDBMS is  a background process (nearly always running on a different machine to the end-user's), that shouldn't come to light.