Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Distinguish between master and slave tables in a relational row database

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Foreign keys are often used in database design, beginners often confuse, according to my experience on the summary.

Primary table: Yes The table where the primary key is located is called the primary table, and the primary key in the primary table is used to associate with other tables. The primary key is unique and cannot be null or duplicate.

Slave table: A table whose primary key value is a foreign key (simply speaking, a table with the same field as the primary key of the primary table (this field is called a foreign key) is called a slave table). The slave table and the primary table are associated through foreign keys. Foreign keys can have duplicates, can be null,

As shown in the figure above, the upper table is the master table and the lower table is the slave table.

It can be simply understood that the primary key of the primary table is used as a foreign key and placed in the secondary table as a foreign key.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report