hello I am making a web system with PHP but one of the requirements that there are multiple users in multiple tables user_table, teacher_table , student_table how can I when I sign up as a user and be asked to which category I belong and be added to the user_table and student table at the same time maybe the requirements I got is wrong? because I couldn't find any tutorial
Asked
Active
Viewed 23 times
0
-
Well, don't do that. Make one table with a classifier column. And then three views, if need be. – mario Jan 10 '21 at 06:45
-
what do you mean by three views? – Mouhamad M. Haydar Jan 10 '21 at 06:47
-
If you don't know what it is, you probably won't need it. `CREATE VIEW students AS SELECT * FROM users WHERE role='student';` – mario Jan 10 '21 at 06:50
-
so you are saying that i won't need a more than one table and I should add a type column – Mouhamad M. Haydar Jan 10 '21 at 06:51
-
@mario even when i have different columns for the students table and the teachers tables – Mouhamad M. Haydar Jan 10 '21 at 07:03
-
The linked question touches on that. If your question was meant to be about an existing misdesign or concrete implementation woes, you will have to [edit] your question with more details (and preferrably some research / we have piles of similar questions). – mario Jan 10 '21 at 07:08