HOW TO USE SELF JOIN IN SQL?

365 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
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

Ganesh Ji Arti A Tribute to Dilip Kumar