JOINS
SQL Joins are used to relate information in different tables. A Join condition is a part of the sql query that retrieves rows from two or more tables.
Self Join
A self-join is a query in which a table is joined (compared) to itself. Self-joins are used to compare values in a column with other values in the same column in the same table
Inner Join
An INNER JOIN is most often (but not always) created between the primary key column of one table and the foreign key column of another table.
The INNER JOIN will select all rows from both tables as long as there is a match between the columns.
Outer Joins
An outer join returns all rows from the joined tables whether or not there's a matching row between them
Left Outer Joins
When you use a left outer join to combine two tables, all the rows from the left-hand table are included in the results.
Right Outer Joins
A right outer join is conceptually the same as a left outer join except that all the rows from the right-hand table are included in the results.
Full outer join
A full outer join combines the results of both left and right outer joins. The joined table will contain all records from both tables, and fill in NULLs for missing matches on either side.
Cross Join
A cross join returns not the sum but the product of two tables. Each row in the left-hand table is matched up with each row in the right-hand table. It's the set of all possible row combinations, without any filtering
0 comments:
Post a Comment