mysql - 大表和小表关联, 在哪个表上建立关联字段, 使查询效率更高
大家讲道理
大家讲道理 2017-04-17 16:39:48
0
3
698
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
巴扎黑

When two tables establish a one-to-many relationship, the "one" end is the parent table, and the "many" end is the child table.
General
Set the primary key in the parent table
Set the foreign key in the child table
According to your choice: Method 2

PHPzhong

Method 2, but it is not recommended to build foreign keys on the database

巴扎黑

Method 1 + Method 2 together, because I want to conveniently query the current version of the file and make data redundant, haha

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!