J
J
Jake Taylor2021-06-13 23:49:43
MySQL
Jake Taylor, 2021-06-13 23:49:43

How to create a relationship between tables in MySQL?

How to organize the relationship correctly, namely, what fields and with what parameters should be created in order to link the accounts , individual and cargo_carriers tables ?

accounts is the user account. When registering, the user will select using the checkbox what type of account he wants to create:
individual (individual) or cargo_carriers (carrier company).

Here is the diagram:
60c66f655fdd1636507601.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Slava Rozhnev, 2021-06-13
@rozhnev

Add an account_id int field to the individual and cargo_carriers tables and create foreign keys to the accounts table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question