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

how to replace double quotes by single quotes in sql server

2 Answers   CAC,


What is the cartesian product of table?

0 Answers  


What are the encryption mechanisms in sql server?

0 Answers  


How to encrypt Strored Procedure in SQL SERVER?

0 Answers  


How to create a local temporary stored procedure?

0 Answers  






Can sql servers linked to other servers like oracle?

0 Answers  


What is blocking and how would you troubleshoot it?

3 Answers   HCL,


Explain different types of locks in sql server.

0 Answers  


What is the use of sign function?

0 Answers  


How can you find out which stored procedures are recompiling?

0 Answers  


What are the disadvantages of primary key and foreign key in SQL?

0 Answers   Alcatel-Lucent,


What is data integrity? Explain constraints?

1 Answers   Thinksoft,


Categories