当前位置:网站首页>In MySQL Association query, the foreign key is null. What if the data cannot be found?

In MySQL Association query, the foreign key is null. What if the data cannot be found?

2022-07-05 03:07:00 CSDN Q & A

The foreign key is null Can you not associate the table , Change to normal query , Can it be realized ?




Take the answer :

The design concept of foreign key is to reasonably restrict the entry of data , Do not allow illegal data to be entered , When querying , There is no limit .

The data that the subject said cannot be found , Two tables should be directly executed join Caused by association , It is recommended to use left join Associate two tables , Common query ( Be sure to display the data ) The watch , Put it on the left side. , The table to be associated can be placed on the right :

select * from table_1 a left join table_2 b on a.key = b.key 

原网站

版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202071715270485.html