A left outer join B
B right outer join A gives the same result then what is
the use of two?
Answer Posted / 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 View All Answers
What are the differences between decimal and float in ms sql server?
How do we know if any query is retrieving a large amount of data or very little data?
What is the optimal disk configuration for a database server and what raid configurations would you use if budget is not a constraint?
Explain what is the purpose of sql profiler in sql server?
How to see existing views in ms sql server?
What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?
What are the database roles? : sql server security
How to create a view with data from multiple tables?
Describe different Processing Modes offered by SSRS?
What is an etl file?
Explain “not null constraint” in sql server?
What is the use of sign function?
Can coalesce return null?
What is the difference between a local and a global temporary table?
What is recompile sql server?