Different Types of SQL Joins

Different Types of SQL Joins

In SQL joins are used to get data from two or more tables based on relationship between some of the columns in tables. In most of the cases we will use primary key of first table and foreign key of secondary table to get data from tables by using this relationship we can reduce the duplication of data in every table. I will explain types of SQL JOINs in in this article. JOINs in SQL Server can be classified as follows: INNER JOIN LEFT OUTER JOIN RIGHT OUTER JOIN FULL OUTER JOIN CROSS JOIN SELF JOIN LEFT JOIN RIGHT JOIN Each type is explained below with suitable examples: Let’s consider two tables as Table1 & Table2 for our example. – CREATE TEST TABLES CREATE TABLE Table1(ID [int], Code [varchar](10)); GO CREATE TABLE Table2(ID [int], Amount [int]); GO