Posted by : Anwar Hossain
Category : Basic sql tutorial for Beginner

How to join two table in sql server

Dear viewer I will show to join two tables based on the relation of two tables. SQL Server join is performed using join keyword and using on keywords. Hear for example I have created two tables which are related to each other that means parent and child table relationship. The parent table name is Department and child table name is Employee .Hear ID is the primary key of Department table which is known as primary column .This DepId is also known as a foreign key for Employee table.

SQL Join example

Department-Table

Department-table

Employee Table

EmployeeTable

SQL Join Syntex

SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;

SQL Statement

SELECT Department.DepartmentName,Employee.Name,
Employee.Email,Employee.PhoneNumber,Employee.Salary
FROM Department
JOIN Employee
ON Department.ID = Employee.DepId

SQL Statement Result

sql-join



Realted Article Headline

How to use MIN () Aggregate Function
How to use MAX () Aggregate Function
How to use SUM () aggregate function
how to use AVG () aggregate function
How to use sql alies for sql table
SQL BETWEEN Operators for retrieving range values
FULL OUTER JOIN using two tables in SQL server
LEFT JOIN using two tables in SQL server
How to join two table in sql server

Article Category

How to create asp.net control dynamically
Learn HTML for beginner
DataList example in C Sharp
Mail sending in asp.net c#
State Management in ASP C #
Basic sql tutorial for Beginner
DataTable example in ASP.Net C#
How to use LINQ in ASP.NET C#
asp.net c # basic tutorial
How to use ajax toolkit in asp.net C#
How to use different types of validation control using asp.net c#
How to use grid view in asp.net c#
Protected by Copyscape Online Plagiarism Detection