ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is the difference between Left join and Right join in SQL?

user-image
تم إضافة السؤال من قبل Yasmeen Husam , Web Developer , Al Fahid Systems
تاريخ النشر: 2018/11/27
Eslam Adel
من قبل Eslam Adel , Senior Full Stack Software Engineer , THIQAH Business Services

LEFT JOIN gets all records from the LEFT linked table but if you have selected some columns from the RIGHT table, if there is no related records, these columns will contain NULL..

RIGHT JOIN is like the above but gets all records in the RIGHT table and null from left table if not relation exists ..

Latika  Arora
من قبل Latika Arora , Software designer , The Royal Bank of Scotland

LEFT join takes all the rows from Left Table anf takes only matching rows from the right table.

RIGHT join takes all rows from the Right Table and takes only  matching rows from the left table.

The SQL left join returns all the values from the left table and it also includes matching values from right table, if there are no matching join value it returns NULL.

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.

Mohd Daud
من قبل Mohd Daud , Production Support Engineer , Technology Kart

LEFT JOIN gives the match data of both tables and unmatched data from left table.

 

RIGHT JOIN gives the match data of both tables and unmatched data from right table

Shafiq Ahmad
من قبل Shafiq Ahmad , Third Party Field Monitor , MicroMerger Pvt. Ltd.

he main difference between these joins is the inclusion of non-matched rows. The LEFT JOIN includes all records from the left side and matched rows from the right table, whereas RIGHT JOIN returns all rows from the right side and unmatched rows from the left table.

Mohammad Masum Omar Jashim
من قبل Mohammad Masum Omar Jashim , Systems Administrator , Enzar Operations & Maintenance Co. Ltd.

LEFT JOIN keeps all the rows from the LEFT TABLE and joins them with the matching rows on the RIGHT TABLE on the key provided. If key is not mentioned then the join automatically switches to a CROSS JOIN

 

Gaurav humbarkar
من قبل Gaurav humbarkar

Left Join will show all record from Left Table and right join will show record from Right table

tushant rajpal
من قبل tushant rajpal , ASP.NET Website Developer , Bit-7 Informatics

Left join in sql refers to the join in which the table connected on the left side of the join will get all records from the left table.

And the Right join in sql refers to the join in which the table connected on the RIGHT side of the join will get all records from the right table.

Zein Helal
من قبل Zein Helal , Software IT - Development Team Supervisor , SolexPLUS

in left join, you get all records from the master table even if no related records through the foreign key in the details tables 

 

in right join, you get all records from the details table even if the foreign key in the master table is null

Manojit Das
من قبل Manojit Das , Software Developer , Velox Solutions Pvt Ltd

Left outer join returns all rows of the table on the left side of "join." The rows for which there is no matching row, is on the right side, and the result contains NULL in the right side. Right Outer Join is similar to Left Outer Join (Right replaces Left everywhere).

Abdul Saboor Awan
من قبل Abdul Saboor Awan , External Monitor , Star Hydro Power Limited, Korea & Asian Development Bank

SQL stands structured query language

المزيد من الأسئلة المماثلة