I’m creating a database for a simple system. The two relevant tables for this question are Users and Categories. They are set as follows:
Users : UserId(Pk), Username, User Type, First Name etc..
Categories: CategoryId(Pk), Name, UserId(Fk)
I have set User Type to be an ‘enum’ and can only have the values admin,moderator or regular. I want to be make it so that only a user with type admin can add a category table.
Is there a way that this can be done?
Thanks
If your users is not also MySQL users, which I assume they are not, then this is not up to MySQL but rather the program interfacing with MySQL, i.e: PHP. You should do the appropriate checks before committing changes to the “restricted” tables.