DATABASE
MANAGEMENT
SYSTEM
JOINS IN SQL
Presented by: Ahmad Raza
Roll No:BSIT51BF20ROO6
SQL JOINS:
A JOIN clause is used to combine rows from two or more tables,
based on a related column between them.
01
Types Of Joins
Here are different types of joins:
a) (INNER)JOIN:
b) LEFT (OUTER)JOIN:
c) RIGHT(OUTER)JOIN:
d) FULL(OUTER)JOIN:
02
(INNER)JOIN:
The INNER JOIN keyword selects records that have matching values in
both tables.
Syntax:
SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;
2.1
(INNER)JOIN:
EXAMPLE:
2.1
LEFT(OUTER)JOIN:
The LEFT JOIN operation in SQL combines the rows from
two tables, with the result being all the rows from the left
table (table A), and matching rows from the right table (table
B). If there is no match in the right table, the result will
contain NULL values for the columns from the right table.
Syntax:
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;
2.2
LEFT(OUTER)JOIN:
2.2
RIGHT(OUTER)JOIN:
The RIGHT JOIN operation in SQL combines the rows from two tables, with the
result being all the rows from the right table (table B), and matching rows from
the left table (table A). If there is no match in the left table, the result will contain
NULL values for the columns from the left table.
SYNTAX:
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.column_name;
2.3
RIGHT(OUTER)JOIN:
2.3
FULL(OUTER)JOIN:
The FULL OUTER JOIN operation in SQL combines the rows from two tables, with the
result being all the rows from both tables, including any unmatched rows. If there is no
match in either the left or the right table, the result will contain NULL values for the
columns from the corresponding table.
SYNTAX:
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name
WHERE condition;
2.4
FULL(OUTER)JOIN:
2.4

database .pptx

  • 1.
  • 2.
    JOINS IN SQL Presentedby: Ahmad Raza Roll No:BSIT51BF20ROO6
  • 3.
    SQL JOINS: A JOINclause is used to combine rows from two or more tables, based on a related column between them. 01
  • 4.
    Types Of Joins Hereare different types of joins: a) (INNER)JOIN: b) LEFT (OUTER)JOIN: c) RIGHT(OUTER)JOIN: d) FULL(OUTER)JOIN: 02
  • 5.
    (INNER)JOIN: The INNER JOINkeyword selects records that have matching values in both tables. Syntax: SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name; 2.1
  • 6.
  • 7.
    LEFT(OUTER)JOIN: The LEFT JOINoperation in SQL combines the rows from two tables, with the result being all the rows from the left table (table A), and matching rows from the right table (table B). If there is no match in the right table, the result will contain NULL values for the columns from the right table. Syntax: SELECT column_name(s) FROM table1 LEFT JOIN table2 ON table1.column_name = table2.column_name; 2.2
  • 8.
  • 9.
    RIGHT(OUTER)JOIN: The RIGHT JOINoperation in SQL combines the rows from two tables, with the result being all the rows from the right table (table B), and matching rows from the left table (table A). If there is no match in the left table, the result will contain NULL values for the columns from the left table. SYNTAX: SELECT column_name(s) FROM table1 RIGHT JOIN table2 ON table1.column_name = table2.column_name; 2.3
  • 10.
  • 11.
    FULL(OUTER)JOIN: The FULL OUTERJOIN operation in SQL combines the rows from two tables, with the result being all the rows from both tables, including any unmatched rows. If there is no match in either the left or the right table, the result will contain NULL values for the columns from the corresponding table. SYNTAX: SELECT column_name(s) FROM table1 FULL OUTER JOIN table2 ON table1.column_name = table2.column_name WHERE condition; 2.4
  • 12.

Editor's Notes

  • #2 © Copyright Showeet.com – Creative & Free PowerPoint Templates
  • #3 © Copyright Showeet.com – Creative & Free PowerPoint Templates
  • #4 © Copyright Showeet.com – Creative & Free PowerPoint Templates