Answer the question
In order to leave comments, you need to log in
What is the best way to create a database structure?
Hello.
In short, there should be two types of users in the system: the customer and the carrier.
The Customer has (ID, Full Name, Phone, Password) and the Carrier has (ID, Full Name, Phone, Password, Mode of Transport).
For Transport, a table is created (ID, Transport name)
There is also a table of orders, in which there are data for these two users + additional data for the order itself.
There was a question on creation of structure of a database.!
Is it possible to leave everything as it is, that is, the customer has its own table, the carrier has its own table, and so on.
OR
create one table USERS, but store a boolean variable (0, - customer, 1 - carrier) and type of transport in it(if 0, then leave empty, if 1, then it will store the ID of the mode of transport (foreign key)) .
Answer the question
In order to leave comments, you need to log in
Are there any other conditions and nuances? Then you can have one page, a boolean variable is not needed, but distinguish by "Mode of transport", if NULL, then the Customer, otherwise the Carrier.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question