WHAT ARE THE TYPES OF JOINS IN SQL?

369 viewsSQLSQL
0

WHAT ARE THE TYPES OF JOINS IN SQL?

Saraswat World Changed status to publish June 8, 2023
0
TYPES of JOIN in SQL
TYPES of JOIN in SQL

JOIN clause combine rows from two or more tables, based on a common field between them.

There are five types of JOIN, defined by ANSI standard SQL

Sr. JOIN TYPES USAGE
1 INNER JOIN Returns records that have matching values in both tables
2 LEFT OUTER JOIN Returns all records from left table and matching records from right table
3 RIGHT OUTER JOIN Returns all records from right table, and matching records from the left table
4 FULL OUTER JOIN Returns all records when there is a match in either left or right table
5 CROSS JOIN Returns combinations of each row of the first table with the each row from second table.
TYPE OF JOINS IN SQL

Syntax for INNER JOIN,LEFT JOIN,RIGHT JOIN,FULL OUTER JOIN-

SELECT <column_name(s)>

FROM <table1>

[INNER JOIN|LEFT JOIN|RIGHT JOIN|FULL OUTER JOIN]<table2>

ON <table1.column_name=table2.column_name>

WHERE<condition>;

Syntax for CROSS JOIN-

SELECT <column_name(s)>

FROM <table1>

CROSS JOIN<table2>;

Saraswat World Changed status to publish June 8, 2023
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

Ganesh Ji Arti A Tribute to Dilip Kumar