INNER, LEFT, RIGHT, and FULL OUTER JOIN Patterns/Inner join active users with subscriptions

Only users who have a matching subscription row appear.

Section: Common join patterns

Inner join active users with subscriptions

sql
sql
SELECT u.user_id, u.email, s.plan_code
FROM users u
JOIN subscriptions s ON s.user_id = u.user_id
WHERE s.status = 'active';
Explanation

`JOIN` without a modifier means `INNER JOIN` in most SQL dialects.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Common join patterns
Left join to find users without subscriptions
Find unmatched left-side rows by checking for `NULL` on the right.
OpenIn sheetsqlsame section
Full outer join to compare two datasets
See items present in one side, the other side, or both.
OpenIn sheetsqlsame section
Emulate FULL OUTER JOIN where unsupported
Use a `LEFT JOIN` + unmatched rows from the other side via `UNION ALL`.
OpenIn sheetsqlsame section