Total Page Preview:   000000000458

What is right join in SQL in English and Hindi

 

Right join in SQL in English

In SQL, a right join is used to combine the result sets of two tables based on the matching values of a specific column(s), where all the records from the right table are included and matching records from the left table are also included, but non-matching records from the left table are excluded.

Here is an example of a right join in SQL:
Suppose we have two tables, "employees" and "departments". The "employees" table contains information about the employees, including their ID, name, and department ID. The "departments" table contains information about the departments, including the department ID and department name.
Employees Table:
Departments Table:
To perform a right join on these tables based on the department ID, we would use the following SQL statement:
The result set of this SQL statement would be:
As you can see, all the records from the right table (departments) are included in the result set, even if there are no matching records in the left table (employees). For example, the department with ID 3 (Finance) has no matching employees in the "employees" table, so the corresponding fields in the result set (EmployeeID and EmployeeName) are NULL. On the other hand, matching records from the left table are included, such as the employee names and IDs in this example.
 
 
 
 
 
Right join in SQL in Hindi
SQL mein right join ka upyog do tables ke result sets ko milakar karte hain, jahan ek specific column(s) ke matching values ke aadhar par right table ke saare records ko shamil kiya jata hai aur left table se matching records ko bhi shamil kiya jata hai, lekin non-matching records left table se exclude kar diye jate hain.
Yahan SQL mein right join ka ek example diya ja raha hai:
 
Maan lijiye humare paas do tables hain, "employees" aur "departments". "employees" table mein karmachariyon ke baare mein jaankari shaamil hai, jisme unke ID, naam aur department ID shamil hain. "departments" table mein vibhagon ke baare mein jaankari shaamil hai, jisme department ID aur department naam shamil hain.
 
Employees Table:
Departments Table:
Department ID ke aadhar par in tables par right join ko perform karne ke liye, hum ye SQL statement ka upyog karenge:
is SQL statement ke result set ka yeh parinaam hoga:
 
Jaisa ki aap dekh sakte hain, right table (departments) ke saare records result set mein shaamil kiye jaate hain, chahe kisi bhi left table (employees) mein matching record na ho. Isi tarah left table se matching records bhi shaamil kiye jaate hain, jaise ki yahan karmachariyon ke naam aur ID.

 

 

 

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments


                           
                           

                           

                           

Facebook User: