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

Write a SQL Query to find first Week Day of month?

2 Answers  


What is thr feature of change data capture?

0 Answers  


What are the differences between left join and inner join in sql server?

0 Answers  


What is transactional replication?

0 Answers  


What are the risks of storing a hibernate-managed object in a cache? How do you overcome the problems?

0 Answers  






What is cte (common table expression)?

0 Answers  


What can be used instead of trigger?

0 Answers   ADITI,


Can you name a few encryption mechanisms in sql server?

0 Answers  


write a query to remove duplicate records without using primary key column?

2 Answers   ABCO,


Are null values the same as that of zero or a blank space?

0 Answers  


What stored by the msdb? : sql server database administration

0 Answers  


What are different types of raid levels?

0 Answers  


Categories