Type of join in SQL
What is SQL join?
SQL join is a combination of data or records from two tables. A join also will locates related column values in the two tables.
There are a several types of join that we can learn :
1) Inner Join
This type of join will select the matching values in both tables.
Syntax for inner join
SQL join is a combination of data or records from two tables. A join also will locates related column values in the two tables.
There are a several types of join that we can learn :
1) Inner Join
This type of join will select the matching values in both tables.
Syntax for inner join
- SELECT column-names
- FROM table-name1 INNER JOIN table-name2
- ON column-name1 = column-name2
- WHERE condition
2) Left Join
This join will select the first left-most table to be matching with the right table records.
Syntax for left join
- SELECT column-names
- FROM table-name1 LEFT JOIN table-name2
- ON column-name1 = column-name2
- WHERE condition
3) Right Join
This join will start by joining the second right-most table and matching with
left table records.
left table records.
Syntax for right join
- SELECT column-names
- FROM table-name1 RIGHT JOIN table-name2
- ON column-name1 = column-name2
- WHERE condition
4) Full Join
This type of join will return all the records from the both tables whether the other tables
have same or match values or not.
have same or match values or not.
Syntax for full join
- SELECT column-names
- FROM table-name1 FULL JOIN table-name2
- ON column-name1 = column-name2
- WHERE condition
Comments
Post a Comment