SQL Basic
SQL Advanced
SQL Functions
| SQL Right Join |
SQL RIGHT JOIN KeywordThe RIGHT JOIN keyword Return all rows from the right table (table_name2), even if there are no matches in the left table (table_name1). SQL RIGHT JOIN Syntax
PS: In some databases RIGHT JOIN is called RIGHT OUTER JOIN. SQL RIGHT JOIN ExampleThe "Persons" table:
The "Orders" table:
Now we want to list all the orders with containing persons - if any, from the tables above. We use the following SELECT statement:
The result-set will look like this:
The RIGHT JOIN keyword returns all the rows from the right table (Orders), even if there are no matches in the left table (Persons). |
SQL Right Join