I’m studying SQL, I made no test at all, so I’m sorry for my stupid question.
apparently (in my guess LOL) LEFT and RIGHT join can be equivalent inverting the tables (operands). is this right?
if yes, so why I should prefer to write this:
SELECT * FROM aaa LEFT OUTER JOIN bbb ON aaa.x = bbb.x
instead of this:
SELECT * FROM bbb RIGHT OUTER JOIN aaa ON aaa.x = bbb.x
In many scenarios, you have to join more than 2 tables – like stored procedures, views or queries you need data from more than 2 tables- . In these scenarios, you need to choose a start point – in this case a table – for your query.
In one, table “aaa” will be suitable to start the query with, in other “bbb” will be better.
That’s simply why
LEFTandRIGHTjoins exist.