can you expand on joins? the sample and explanation sounds confusing. consider the snippet from your example, customer RIGHT OUTER JOIN payment on customer.customer_id = payment.customer_id WHERE payment.customer_id IS NULL;
why such addition in where clause? we are joining using customer_id, then why should we have IS NULL
In RIGHT OUTER JOIN, all rows from the right table are included, unmatched rows from the left are replaced with NULL values. So to get those unmatched data explicitly, WHERE keyword with a condition IS NULL is used. As you said you can simply eliminate the WHERE condition and see for yourself for a better understanding.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
can you expand on joins? the sample and explanation sounds confusing. consider the snippet from your example,
customer RIGHT OUTER JOIN payment on customer.customer_id = payment.customer_id WHERE payment.customer_id IS NULL;
why such addition in
where
clause? we are joining using customer_id, then why should we haveIS NULL
In
RIGHT OUTER JOIN
, all rows from the right table are included, unmatched rows from the left are replaced withNULL
values. So to get those unmatched data explicitly,WHERE
keyword with a conditionIS NULL
is used. As you said you can simply eliminate the WHERE condition and see for yourself for a better understanding.