SQL INNER JOIN — Match Both Sides
INNER JOIN returns only records with matching rows on both sides. It is mostly standard across all four dialects; older MySQL sometimes uses implicit join (FROM a, b WHERE).
Open the interactive DevRef Hub tool →Key facts
| Syntax | SELECT u.name, o.total FROM users u INNER JOIN orders o ON o.user_id = u.id; |
|---|---|
| Result | Only matched rows |
| Implicit (legacy MySQL) | FROM a, b WHERE |
| Portability | Standard in all 4 dialects |
Frequently asked questions
What does INNER JOIN do?
It returns only rows that match on both tables.
INNER JOIN vs LEFT JOIN?
INNER drops unmatched rows; LEFT keeps all left rows, NULL on the right.
Related pages
SQL INNER JOIN is part of DevRef Hub on GOAT Lab — a free reference you can use without signing up, and it works offline. Open the tool above for any custom value.
Part of GOAT Lab — 26 free, browser-based science, engineering and developer tools. No sign-up.