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 |
What are .mdf files?
How to execute function in stored procedure sql server?
how to create a scrollable cursor with the scroll option? : Sql server database administration
Explain what is cte (common table expression)?
What are the types of indexes?
What is compound operators?
Define union, union all, minus, intersect?
Explain the storage models of OLAP?
What is the maximum size of a row in sql server?
What is the difference between value type and reference type?
if 3 duplicate records in a table,i want to delete 2 duplicate records by keeping 1 duplicate and 1 original as it is,how?
How can I check if a view exists in a sql server database?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)