sql - How do I know which table is left and right mysql -


i know first select query left table, still confused when use right , left join:

ex:

select chann.name investments inv right join channels chann on chann.id = inv.channel_id;   select chann.name channels chann left join investments inv on chann.id = inv.channel_id; 

they both return same result, why in first query used right , why left on second one, have foreign key something?

thanks

in example both query same, because when change right left change tables order. simple understanding this, consider follow example:

select a.* table1 left join table2 b on a.key=b.key 

in case, left join means records table1, because table in left. if use right means records table 2


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -