CadencePlus Solutions

INNER and LEFT JOIN

Joins match rows using a condition. Choose the join according to which unmatched rows your answer must retain.

INNER JOIN

INNER JOIN returns matching pairs only. A customer with no orders will not appear in a customers-to-orders inner join. Multiple matches generate multiple result rows.

LEFT JOIN

LEFT JOIN retains every left-table row. For an unmatched customer, columns from orders are NULL. LEFT refers to the table written before the join, not a diagram’s screen position.

ON versus WHERE

ON defines matches. WHERE filters the joined result. After a LEFT JOIN, WHERE o.status = 'paid' removes unmatched rows. Put that condition in ON if you want all customers and only their paid orders.

Qualified columns

Use aliases and qualified names such as c.customer_id and o.customer_id when columns share names. SELECT explicit outputs so the resulting table is clear to a reviewer.