explain different types of jions with examples briefly?

Answers were Sorted based on User's Feedback



explain different types of jions with examples briefly?..

Answer / hari

Inner join
outer join--left outer join ,right outer join , full outer
join
Cross Join

Is This Answer Correct ?    4 Yes 0 No

explain different types of jions with examples briefly?..

Answer / 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

More SQL Server Interview Questions

What are the events recorded in a transaction log?

0 Answers  


What are the difference between primary keys and foreign keys?

0 Answers  


Restore database SQL2000, SQL2012 Backup of base is created in Microsoft SQL Server 2000 - 8.00.2066, I can't restore on Microsoft SQL Server 2012 - 11.0.2100.60

3 Answers   IT Decisions,


What is onf in normalization form?

0 Answers  


Ms sql server index?

0 Answers  






What will be the value of @@fetch_status if a row that was a part of the cursor resultset has been deleted from the database after the time the stored procedure that opened the cursor was executed?

0 Answers  


How to find the date and time of last updated table?

6 Answers   Teledata,


Which tcl commands are available on the sql server?

0 Answers  


There are two tables (T1, T2) with different rows. Find the output of query. Select count(*) from T1,T2.

3 Answers   Amdocs,


what is checksum in sql server.........???

0 Answers   TCS,


How do I create a stored procedure in dbml?

0 Answers  


What is a coalesce function?

0 Answers  


Categories