Answer the question
In order to leave comments, you need to log in
How to correctly create a table of two types of users in the database?
The database is being designed. The site should have account types with columns listed in brackets:
- Individual (last name, first name, email, password);
- Legal entity (last name, first name, email, password + company name, company's UNP).
There are common data: last name, first name, email, password , which can be placed in a separate table, let's call it accounts . Right? What should be the tables then in the database? The accounts table, the individuals table and the company table like this:
either create only one accounts table and where the user will have the role = "Individual", null fields will be filled in, which must be filled in the company, and these are the fieldscompany name, UNP company ?
Answer the question
In order to leave comments, you need to log in
Because of the 3 fields, there is absolutely no point in creating separate tables. You will lose more in performance by constantly using JOIN
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question