HOW TO USE SELF JOIN IN SQL?

349 viewsSQLSQL
0

HOW TO USE SELF JOIN IN SQL?

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

SELF JOINย is a regular join used to join the table with itself.

Syntax of SELF JOIN in SQL-

SELECTย <column_name(s)>

FROMย <table1> t1, <table1>t2

WHERE<condition>;

Example of SELF JOIN in SQL-

SELECTย A.CustomerNameย ASย Customer1, B.CustomerNameย ASย Customer2,ย A.City
FROMย Customers A, Customers B
WHEREย A.CustomerID <> B.CustomerID
ANDย A.City = B. City;

โ€” SELF JOIN query customers that are from the same city.

Saraswat World Changed status to publish June 8, 2023
You are viewing 1 out of 1 answers, click here to view all answers.
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

A Tribute to Dilip Kumar