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 sql server replication? : sql server replication

536


What are the two authentication modes in sql server?

603


How to return the second 5 rows in ms sql server?

634


What is the difference between a function and a trigger?

573


List all the types of user-defined functions?

520






Explain an automatic checkpoint

560


how you can list all the tables in a database?

522


How to rename an existing column with the "sp_rename" stored procedure in ms sql server?

552


What is an index. What are the types?

582


What do you mean by collation recursive stored procedure?

593


what types of replication are supported in sql server? : Sql server database administration

466


How to add the custom code in Report?

99


What is exporting and importing utility?

608


Why would you call update statistics?

581


how to define testing of network layers? : Sql server database administration

492