I have a user table that he can be either a teacher or headmaster only. I think that disjoint specialization it is the appropriate for it in ER. I'm using MySQL dbms and after I created the tables I created a user in User table(for example UserId=31). But the problem is when I'm inserting a new record to teacher table with a UserId =31 and inserting the same UserId in headmaster table it doesn't give any error. I think this is considered a violation for disjoint property.
I have a user table with this attributes
User(UserId, Username, Password, gender, name, address, education, university, mobile).
and teacher table that it comes after mapping like this
teacher(UserId,courses).
and headmaster table. headmaster(UserId,Years_Of_Service).
When I had created teacher and headmaster tables I created them without a primary key, then I added an index for UserId attribute in each table and make it reference to UserId in User table.
My Question: How I can implement the disjoint for my tables using MySQL?
Thanks in advance