Right join in SQL, DBMS

Last modified on January 3rd, 2019 at 2:47 pm

Right join in SQL, DBMS

Today, in this fresh and new article, we will cover the following topics;

  1. What is right join?
  2. Example of right join
  3. Query of right join

Right join shows all rows from the right table and shows only matching rows from the left table.

RegistrationNoMarks
T4Tutorials177
T4Tutorials232
T4Tutorials455

Table: Exams

Inner join shows results from both tables where there is any match between columns in both tables.

RegistrationNoFee
T4Tutorials11000
T4Tutorials22000

Table: Accounts

Now, we have two different tables. If we want to show the record of both tables in one single table then we can use right join to join both two tables.

Query of right join

SELECT Exams.RegistrationNo, Exams.Marks, Accounts.Fee FROM Exams RIGHT JOIN Accounts ON Exams.RegistrationNo =  Accounts.RegistrationNo

In this query Accounts is the right table.

RegistrationNoMarksFee
T4Tutorials1771000
T4Tutorials2322000

Table: Generated after Right Join

 

Test Your Understandings

1.Right join shows some rows from right table ? YES / NO

Answer - Click Here:
No, its show all rows

2. Right join shows all rows from left table? YES / NO

Answer - Click Here:
No, it can only show matching rows from left table.

3. SELECT Exams.Marks, Accounts.Fee FROM Exams Right JOIN Accounts?

In this query, exams are the right table and accounts is the left the table.

Yes/No

Answer - Click Here:
Yes

Topic Covered

Right join in SQL, DBMS.

Prof. Fazal Rehman Shamil
Researcher, Publisher of International Journal Of Software Technology & Science ISSN: 2616-5325
Instructor, SEO Expert, Web Programmer and poet.
Feel free to contact.