Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- | Join Type | Syntax | Also Known As | Description |
- | --------------------- | -------------------------------------------------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
- | CROSS JOIN | ```sql SELECT * FROM table1 CROSS JOIN table2; ``` | Cartesian Join | Returns the Cartesian product of the two tables, combining each row from the first table with every row from the second table. |
- | INNER JOIN, aka. JOIN | ```sql SELECT * FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name; ``` | Equi Join | Returns only the rows that have matching values in both tables based on the specified join condition. |
- | OUTER JOIN | ```sql SELECT * FROM table1 LEFT OUTER JOIN table2 ON table1.column_name = table2.column_name; ``` | Full Outer Join | Returns all rows from both tables, with matching rows from both tables where available. If there is no match, NULL values are used. |
- | LEFT OUTER JOIN | ```sql SELECT * FROM table1 LEFT JOIN table2 ON table1.column_name = table2.column_name; ``` | Left Join | Returns all rows from the left table and matching rows from the right table where available. If there is no match, NULL values are used for the columns from the right table. |
- | FULL JOIN | ```sql SELECT * FROM table1 FULL JOIN table2 ON table1.column_name = table2.column_name; ``` | Full Outer Join | Returns all rows from both tables, with matching rows from both tables where available. If there is no match, NULL values are used for the columns from the respective table. |
- | NATURAL INNER JOIN | ```sql SELECT * FROM table1 NATURAL JOIN table2; ``` | Natural Join | Joins tables based on columns with the same name, automatically eliminating duplicate columns in the result set and returning only the columns from the first table. |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement