A left outer join B
B right outer join A gives the same result then what is
the use of two?



A left outer join B B right outer join A gives the same result then what is the use of two?..

Answer / nithya

Is ur query used in any situation? bcos
In general join is used in the following case:

consider "Persons" table:
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger

"Orders" table:
O_Id OrderNo P_Id
1 77895 3
2 44678 3
3 22456 1
4 24562 1
5 34764 15

left outer join:

SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
LEFT outer JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName

The result-set will look like this:
LastName FirstName OrderNo
Hansen Ola 22456
Hansen Ola 24562
Pettersen Kari 77895
Pettersen Kari 44678
Svendson Tove

right outer join:

SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
RIGHT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName

The result-set will look like this:
LastName FirstName OrderNo
Hansen Ola 22456
Hansen Ola 24562
Pettersen Kari 77895
Pettersen Kari 44678
34764

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More SQL Server Interview Questions

could you please reply for these question: 1.About Use Apply? 2.Avoid cursors - When we have a situation that we can not avoid the use of cursor than what is the alternate solution? is there anything we can use instead of cursor to perform the desired task? which optiomize the peroformance too. 3.What is computed columns? Thanks in advance. Regards, Rupesh

3 Answers  


What is database black box testing?

0 Answers  


What happens when converting big values to numeric data types?

0 Answers  


What is set nocount on and what is set nocount off?

0 Answers  


What is the purpose of optimization?

0 Answers  






How would you retrieve Unique rows from table without using UNIQUE and DISTINCT keyword?

2 Answers   Genpact,


what are constraints? : Sql server database administration

0 Answers  


Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?

0 Answers  


What is an index?

8 Answers   Yardi Software,


What is query cost in sql server?

0 Answers  


Is a null value equal to anything? Can a space in a column be considered a null value? Why or why not?

0 Answers  


What is fill factor and pad index?

0 Answers  


Categories