Association of database tables

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description hereInsert picture description here
Insert picture description here

The foreign key must be the primary key of another table

The many-to-many relationship is realized by two one-to-many relationships. (Create an intermediate table to achieve a many-to-many relationship)

Insert picture description here
Insert picture description hereWhen the one-to-many table is associated, we just add a foreign key on the more side.

For many-to-many table association, we need to add a table in the middle for association

Insert picture description here

Guess you like

Origin blog.csdn.net/liulang68/article/details/109296425