explain different types of jions with examples briefly?

Answer Posted / soni

Inner join: This type of join displays matched rows from
tables.
this is based on equality condition ,so also called
equijoin.
exp- select empid,d.deptid,deptname,empname,location,salary
from emp e inner join dept d on e.deptid=d.deptid

Cross join: this is not based on any condition. It results
every row of one table matching with every row of another
table.
exp- select * from emp cross join dept

Self join: This ype of join joins a table to itself.


outer join:
Three types -
a.left outer join: It reults mathed rows from both tables
as well as all unmatched rows from left table.
exp- select empid,d.deptid,deptname,name,location,salary
from emp e left outer join dept d
on e.emp=d.dept

it displays all data from emp table .

right Outer join:It reults mathed rows from both tables as
well as all unmatched rows from right table.
exp- select empid,d.deptid,deptname,name,location,salary
from emp e right outer join dept d
on e.emp=d.dept

it displays all data from dept table .

Full Outer Join: This type of join results all matched
rows from both tables as well as umatched rows from both
tables.
exp.-select empid,d.deptid,deptname,name,location,salary
from emp e full outer join dept d
on emp e=d.dept d
It displays all matched and unmatched rows from both emp
and dept tables.

Is This Answer Correct ?    5 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the tcp/ip port on which sql server runs?

655


How do you start single user mode in clustered installations?

605


What is query optimization process?

603


What part does database design plays a role in performance of an sql server-based application?

615


What are triggers in ms sql server?

698






How to create a stored procedure with a statement block in ms sql server?

661


How to recover from sql injection? : sql server security

599


How data can be copied from one table to another table?

591


What are the various editions of sql server 2017 that are available in the market?

576


What are the advantages of having an index on the sql server?

611


What does it mean to manipulate data?

661


Explain datetime2 data type in sal server 2008?

613


Tell me about builtinadministrator?

647


why would you use sql agent? : Sql server database administration

624


Do you know what is raid and what are different types of raid configurations? : SQL Server Architecture

636