To 'emulate' inheritance in database i decided to use so called Table-Per-Type pattern (lerned recently from StackOverflow). I have the a Users with the most common colums for all users and i have a table Developers with additional info. This table is used to store some additional information about users whose role is developer.
There is Primary key ID
for Users, which is AUTO_INCREMENT
and also ID
column in Developers table which is PK itself and also a FK referencing to Users.ID
.
I am writing an SQL Query to populate my table with some test data. Trying to add new Developer i faced the problem: i do not understand how to INSERT new deverloper-user in both tables Users
and Developers
, because Users.ID is automatically generated and it must be equal to Developers.ID.