Home Application Develop How to Use Joins in SQL Server Tutorial in Urdu

How to Use Joins in SQL Server Tutorial in Urdu

13
0

Today, We Will learn How to Use Joins in SQL Server in Urdu/Hindi Language. Basically, Joins are used to view record multiple tables. There are four types of Join, they are working different, but mostly use Inner Joins to view multiple table record.  You have made many different tables, and you have included relationship one to many or many to many. So, you will run a query like “select * from table name”, you doesn’t display readable record. So, Users doesn’t understand it.

If you want to display readable record, you can use Joins in SQL Server to display record as well.  Joins are used two or more tables are joined than you can display record as well. However, I have used mostly Inner joins, but sometimes use another join such as Left Join, Right Join or Full Join.

joins-in-sql-server

Furthermore, more than beginners facing problems how to use joins. And they are don’t understand it, basically, Joins are added multiple table’s column Names, and you can Match different tables IDs than you will get results as well.

Inner Join Example:

First of All, We will require tables to use Inner Joins. I have made three tables namely “Category”, “Product” and “JoinTable”.

create table Category (Ct_ID int primary key identity(1,1), Category_Name varchar(50))

create table Products(Pr_ID int primary key identity (1,1), ProductName varchar(50))

I have inserted record in two tables:

insert into Cateogry values(‘Nokia’),(‘Samsung’)

insert into Products values (‘Lumia’),(‘Galaxy’),(‘ Nokia Lumia 801’), (‘Samasung Galaxy 7’)

I have made “Category” and “ Product” Table relationship with another Table namely “JoiTable”.

create table joinTable
(
J_ID int primary key identity(1,1),
C_ID int foreign key references Cateogry(Ct_ID),
Pr_ID int foreign key references Products(Pr_ID)
)

After that, I have inserted record on Join Table:

insert into joinTable values (1,1),(1,3),(2,2),(2,4)

That’s simple process to make tables, Insert Record and Use Relationship. Now come to point, If you want to search “joinTable”, then you can see below result:

view-record-without-joins

But I want to display record readable, So, I want to use Joins. I have already told you, there are four Joins, and below used to Inner Join Tables and display record as well.

select Cateogry.Category_Name,Products.ProductName
from joinTable inner join
Cateogry on
joinTable.C_ID=Cateogry.Ct_ID
inner join Products on
joinTable.Pr_ID=Products.Pr_ID

After use, Inner join you can see the record on below as well.

inner-joins-result

Right Join Query and Result:

select Cateogry.Category_Name,Products.ProductName
from joinTable right join
Cateogry on
joinTable.C_ID=Cateogry.Ct_ID
right join Products on
joinTable.Pr_ID=Products.Pr_ID

rightjoin-in-sql-server

Left Join Query and Result:

select Cateogry.Category_Name,Products.ProductName
from joinTable left join
Cateogry on
joinTable.C_ID=Cateogry.Ct_ID
left join Products on
joinTable.Pr_ID=Products.Pr_ID

left-joins-in-sql-server

Full Join Query and Result:

select Cateogry.Category_Name,Products.ProductName
from joinTable full join
Cateogry on
joinTable.C_ID=Cateogry.Ct_ID
full join Products on
joinTable.Pr_ID=Products.Pr_ID

fulljoin-in-sql-server

However, that’s the simple process to use SQL Server Joins. I have made a video tutorial, I discussed How to Use SQL Server Joins and Display Record in Windows Form Application GridView. So, I recommended All of you watch below tutorial, you can more ideas about Joins in SQL Server and Display Record with GridView.

How to Use Joins in SQL Server Tutorial in Urdu

Thanks for Watch Complete video, after watch this video tutorial, I hope you have understood as well, and you will learn it something new. Kindly, share my content on social networks, and subscribe my website social networks pages like Facebook, Google+, Twitter, YouTube and Email for post updates.

If you have any question / suggestion about this topic, comment or email me after received your email or comment, I will reply with your answer maximum 24 hours. Thanks Again for a visit, Read my Complete Article and Watch my Videos. Keep touch my website, I will share very soon application like  Android Application very soon.

Subscribe My YouTube Channel For Get Updates 🙂