By 25/02/2016 3 Comments

What Is RIGHT JOIN Keyword In SQL?

  • The SQL RIGHT JOIN keyword joins multiple database tables with each other.
  • The SQL RIGHT JOIN is a keyword which is used to retrieves/selects all records/rows from multiple database tables even if there are no match between the columns in each tables.
  • When you use SQL RIGHT JOIN keyword all matching rows/records of right table are selected/listed along with left table but the result will be NULL in left table if there are no match found in left/parent table.
  • SQL RIGHT JOIN is also called RIGHT OUTER JOIN in some databases.

Syntax:

SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name=table2.column_name;

Example:

SELECT co.country_name, ci.city_name
FROM country AS co
RIGHT JOIN city AS ci
ON co.country_id = ci.country_id;

OR

Example:

SELECT co.country_name, ci.city_name
FROM country AS co
RIGHT OUTER JOIN city AS ci
ON co.country_id = ci.country_id;

Note:
In above example the RIGHT JOIN keyword returns all the rows from the right table (city ), even if there are no matches in the left table (country).







Posted in: Sql

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .