Advertisement
SilvanM

Untitled

Jul 23rd, 2024
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1.  
  2. | Join Type | Syntax | Also Known As | Description |
  3. | --------------------- | -------------------------------------------------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  4. | 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. |
  5. | 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. |
  6. | 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. |
  7. | 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. |
  8. | 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. |
  9. | 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. |
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement