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
Leave a Reply