SQL JOIN Command :
The SQL JOIN query is used to combine two or more tables base on common column name to retrieve record from all that tables.
Types of SQL JOIN Command :
There are 4 types of JOIN Command are used in SQL Server.
1- Inner join.
2- Left join.
3- Right join.
4- Full outer join.
Inner join :
In SQL Inner join command selects all common record from two or more table which have same column name.
Example :
Following the SQL statement select the common record from both tables based on common column name i.e. ‘salesman_id’ is in both tables.
select * from Customer inner join Salesman on
Customer.salesman_id=Salesman.salesman_id;
Write the SQL inner join statement to find the Salesman and Customer who belongs to same city. Returns the salesperson, cust_name and city.
Salesman Table :
Customer Table ;
SQL Statement :
select Salesman.name,Customer.cust_name,Customer.city from Salesman inner join Customer on
Salesman.salesman_id=Customer.salesman_id;