Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Left join in SQL and DBMS

Left join in SQL and DBMS

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

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

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

RegistrationNoMarks
T4Tutorials177
T4Tutorials232

Table: Exams

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

RegistrationNoFee
T4Tutorials11000
T4Tutorials22000
T4Tutorials33000

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 a left join to join both two tables.

Query of left join

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

RegistrationNoMarksFee
T4Tutorials1771000
T4Tutorials2322000

Table: Table generated after Left Join

 

Test Your Understandings

1. Left join shows some rows from left table ? YES / NO

Answer - Click Here:
No, its show all rows

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

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

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

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

Yes/No

Answer - Click Here:
No, exams is left table

Topic Covered

Left join in SQL and DBMS.

Fazal Rehman Shamil Click Here to Know More
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325
Dear Professors and Resarchers!You are welome to Cite these tutorials in your research or slides etc. Please don't forget to mention the reference of website. Copy Paste of text is strcitly forbidden. Images can be reuse because images are protected with watermark.

Leave a Reply

Your email address will not be published. Required fields are marked *