Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

polarcubs's avatar

Should I create separate tables for each role?

Hi, would like to have some advice on database modelling.

While developing an internal site that has multiple roles. Some roles as expected have extra fields and relationships with some other tables that not all users should have.

Having learn some basic Java OOP before this, my natural inclination is to create new tables for them, such as a students table or a teachers table with a foreign key linking to the users table. For example only students have sports activities and it doesn't sound right to put the sports() relations method in the users table for all.

However, somewhere, something in me is also telling me that this may give me more issues and troubles down the line. More roles may be added in the future. I need to get and update both the students and users table when I'm updating profile information. That maybe it's better to just put them all in the users table and treat them generically with just a user and roles table. If the role is not a student, I can just ignore the sports() method for example and not call it.

What are your thoughts from your experience?

0 likes
1 reply
luceos's avatar

Why not add it in one and the same table? And for those roles that do not have any relationships, allow the column/attribute to be null?

Please or to participate in this conversation.