In Relational database tables are associated with each other and we used foreign key to maintain relationships between tables. We used join clause to retrieve data from associated tables. The join condition indicates how column in each table are matched against each other.
There are two types of joins clause in SQL
Outer join is again divided into parts −
Sr. No. | Key | Inner join | Outer join |
---|---|---|---|
1 | Basic | It can be used to retrieve only matched records between both tables | It is used to retrieve all matching records as well non matching records of the tables |
2 | Return | It doesn't return anything when match is not found. | It return null in the column values |
3 | Performance | It is faster than outer join. | It is slower than inner join because of the larger result set |
SELECT columnnameList FROM tableA FULL OUTER JOIN tableB ON tableA.column_name = tableB.column_name WHERE condition;
SELECT columnlist FROM TableA INNER JOIN TableB ON join condition