These two MySQL queries return the same value:
select photographer_lname, image_title
from photographer
right join image
on photographer.photographer_id=image.photographer_id;
from image
left join photographer
on photographer.photographer_id=image.photographer_id;
In the second query, the left join returned all the rows from the first table (image), even if there was no value from the second table (photographer.)
Left and right refer to the first and second tables. Left- first table, right- second table.
Below, this is the general example for all rows returned, from the table in CAPS:
select column1, column2
from TABLE1
left join table2
select column1, column2
from table1
right join TABLE2

No comments:
Post a Comment