当前位置:网站首页>Difference between left join on and join on

Difference between left join on and join on

2022-06-25 02:49:00 Spring wind neon clothes

Reference resources :https://blog.csdn.net/lovebosom/article/details/51035894
Join Equate to inner join : Indicates that both tables must exist
left join Indicates that the table on the left is the benchmark , Whether or not the table on your right shows
right join and left join Just the opposite
full outer join It means that as long as there is something in any of the two tables, it will be displayed
The same thing : Through the association table , Use where Find the desired data

1、 When two tables , When the associated data value has no value in a table , At this time left join When the table on the left has a value , You can also query the value , And the data in the right table are all represented by null Express !
eg:
left join…on…
 Insert picture description here
You can see left join…on…, This is the case when the data associated with the table on the right does not exist , yes Can't Treat the associated data as useless data ;

join…on…

 Insert picture description here

You can see join…on…, This is the case when the data associated with the table on the right does not exist , Meeting Treat the associated data as useless data , Such data will not be queried ;

2、 When using conditions in association ,left join…on… All the information in the main table that does not meet the conditions will be found , But schedule ( Association table ) All fields will use null Express , So sometimes , When you want to query the main table that does not meet the conditions , You can add where Schedule id=null Find out ! and join…on… The unsatisfied data will be directly ignored , Will not be found out

eg:
left join…on…
 Insert picture description here

join…on…

 Insert picture description here

原网站

版权声明
本文为[Spring wind neon clothes]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206242326241714.html