Javatpoint Logo

91-9990449935

 0120-4256464

Javatpoint Logo

SQL RIGHT JOIN

The SQL right join returns all the values from the rows of right table. It also includes the matched values from left table but if there is no matching in both tables, it returns NULL.

Basic syntax for right join:

let us take an example with 2 tables table1 is CUSTOMERS table and table2 is ORDERS table.

CUSTOMER TABLE:

IDNAMEAGESALARY
1ARYAN5156000
2AROHI2125000
3VINEET2431000
4AJEET2332000
5RAVI2342000

and this is the second table:

ORDER TABLE:

DATEO_IDCUSTOMER_IDAMOUNT
20-01-201200123000
12-02-201200222000
22-03-201200334000
11-04-201200445000

Here we will join these two tables with SQL RIGHT JOIN:

IDNAMEAMOUNTDATE
2AROHI300020-01-2012
2AROHI200012-02-2012
3VINEET400022-03-2012
4AJEET500011-04-2012
Next TopicSQL Full Join




Latest 4 Tutorials on JavaTpoint