Back to Learn SQL
MySQL BasicsIntermediate10 min
MySQL JOIN Types Visualized
Understand INNER, LEFT, and RIGHT JOIN behavior to combine tables correctly.
What You Will Learn
- INNER JOIN keeps only matching rows.
- LEFT JOIN keeps all rows from the left table even without matches.
- Always verify join keys and cardinality before shipping queries.
Sample SQL
SELECT o.id, u.name, o.total_amount
FROM orders o
LEFT JOIN users u ON o.user_id = u.id
WHERE o.created_at >= DATE_SUB(CURDATE(), INTERVAL 30 DAY);Next Step
Try rewriting this query in your own schema, then use our tools to format and refine it.