S
S
Sssameeri2020-05-13 18:54:55
Database design
Sssameeri, 2020-05-13 18:54:55

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

3 answer(s)
D
Dr. Bacon, 2020-05-13
@bacon

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.

A
Andrey Skorzhinsky, 2020-05-15
@AndyKorg

5ebe758f4d6b7808439457.jpeg

E
edo1h, 2020-05-18
@edo1h

A question from the category of "blonde or brunette", a matter of taste.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question