I'm back with a very quick addition.
This is a frequently asked question that I get pretty often, which is, is there really a big difference
between right and left joints?
If we just change the order of what we're joining and the answer is no, they're actually the same.
So if we do a left join where this is customers A and then on the right we have orders that's identical
to doing a right join.
If instead we put customers over here and we put orders under a so think of it as just flipping this.
There's no difference.
So let me show you an example.
If we go and we go grab our simple left, join from way back here.
This one right here are simplest left join and I will paste it down here just so you have it to see
and let's paste it in as well.
Okay.
First of all, there's a lot to look at, right?
But what's most important is that we have on the left customers information first, and then on the
right we have our order information right.
And then we have nulls where we don't have a matching order.
So what happens if we try and do the same thing?
But instead of doing customers first, we do orders and we do a right join customers on customers ID
equals orders dot customer ID.
So if we do this.
Look at what we get here.
So we have the exact same data.
One, two, three, four, five rows.
One, two, three, four, five.
But the order that they're printed is different, right?
So we have on the left side now we have our orders, information.
And then on the right, we have our customers information.
But the actual data that's displayed is the same.
Yes, the order changes.
But that's trivial.
That doesn't matter.
So in effect, these are equivalent.
And in fact, some like some environments that I've come across, some developing environments won't
even support a right join.
And they just want you to do a left join and switch the order.
So to actually to sum up one more time, let's say I did the same thing here with orders and customers,
but I did a left join.
What would happen now?
What's a left join with orders first and then customers.
And the answer is it's the same as doing a right join, except if we start with customers and then orders.
And unfortunately, we don't really have anything to see.
Right, because our data doesn't have any discrepancies on the order side.
This is what the entire last video is about, which I will not retread here.
But my point is that they look the same and they look just like an inner join as well.
But when we have something different, like with our left join for customers and orders, you can see
that the data is actually the same.