Skip to content

Instantly share code, notes, and snippets.

@dwdraju
Last active September 6, 2018 09:24
Show Gist options
  • Save dwdraju/86bd6b10c26e718e221edfdba9f78029 to your computer and use it in GitHub Desktop.
Save dwdraju/86bd6b10c26e718e221edfdba9f78029 to your computer and use it in GitHub Desktop.
mysql Join

INNER JOIN: returns rows when there is a match in both tables.

LEFT JOIN / LEFT OUTER JOIN: returns all rows from the left table, even if there are no matches in the right table.

RIGHT JOIN / RIGHT OUTER JOIN: returns all rows from the right table, even if there are no matches in the left table.

FULL JOIN / FULL OUTER JOIN / OUTER JOIN: returns rows when there is a match in one of the tables.

SELF JOIN: is used to join a table to itself, as if the table were two tables, temporarily renaming at least one table in the SQL statement.

CARTESIAN JOIN: returns the cartesian product of the sets of records from the two or more joined tables.

src: https://stackoverflow.com/a/15425824

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment