HOW TO USE RIGHT JOIN IN SQL?

402 viewsSQLSQL
0

HOW TO USE RIGHT JOIN IN SQL?

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

RIGHT JOIN/RIGHT OUTER JOIN clause select all the records from right table(table2) and the matching records from the left table(table1).

Syntax of RIGHT JOIN in SQL-

SELECT <column_name(s)>

FROM <table1>

RIGHT JOIN<table2>

ON <table1.column_name=table2.column_name>WHERE<condition>;

Example of RIGHT JOIN in SQL-

SELECT Customers.CustomerName, Orders.OrderID

FROM Customers

RIGHT JOIN Orders

ON Orders.CustomerID = Customers.CustomerID;

RIGHT JOIN returns all records from the right table (Orders), even if there are no matches in the right table (Customers). In the above example, the SQL statement will select all orders, and their customers.

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