Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par Yasmeen Husam , Web Developer , Al Fahid Systems
Date de publication: 2018/11/27
Eslam Adel
par 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
par 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
par 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
par 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
par Mohammad Masum Omar Jashim , Logistics & IT Coordinator , Arabian Delta Specialized Trading Co.

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

 

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

tushant rajpal
par 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
par 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
par 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
par Abdul Saboor Awan , External Monitor , Star Hydro Power Limited, Korea & Asian Development Bank

SQL stands structured query language

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?