Hi guys
I have a little mess up in my head going on i dont really know why.
My question is how come a right join AND a left join were made to handle database queries, why both of them, isn t one enough?
for instance let s take the left join.
syntax:
SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
and we get all the rows from table_name1 and rows from the other table which do have a match
Now if we SWITCH the tables
syntax:
SELECT column_name(s)
FROM table_name2
LEFT JOIN table_name1
ON table_name1.column_name=table_name2.column_name
and we get all the rows from table_name2 which we could have done with RIGHT JOIN as well but we would have to switch tables.
Once again WHY isn t a for example Left join enough why does a right join exist? VICE VERSA.