Q
Problem solve Get help with specific problems with your technologies, process and projects.

Multiple outer joins

Is it possible to have more than one outer join in a SQL statement which involves more than two tables involved?

Yes, it is possible. Just look at the following example:

SQL> select o.owner,u.user_id,d.profile,o.object_type,count(*) as num_types
  2  from objects o, users u, db_users d
  3  where o.owner=u.username(+)
  4    and o.owner=d.username(+)
  5    and o.object_type in ('TABLE','INDEX')
  6* group by o.owner,u.user_id,d.profile,o.object_type;

OWNER         USER_ID PROFILE    OBJECT_TYPE         NUM_TYPES
---------- ---------- ---------- ------------------ ----------
OUTLN              11            INDEX                       3
OUTLN              11            TABLE                       3
PEASLAND           18 DEFAULT    TABLE                       2
SYS                   DEFAULT    INDEX                     249
SYS                   DEFAULT    TABLE                     264
SYSTEM                DEFAULT    INDEX                     144
SYSTEM                DEFAULT    TABLE                     108

7 rows selected.

You can clearly see that I've used two outer joins here. Notice the missing information in both the user_id and profile columns indicative of the outer join.

For More Information

  • What do you think about this answer? E-mail the Edtior at tdichiara@techtarget.com with your feedback.
  • The Best Oracle Web Links: tips, tutorials, scripts, and more.
  • Have an Oracle or SQL tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
  • Ask your technical Oracle and SQL questions--or help out your peers by answering them--in our live discussion forums.
  • Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.

Dig Deeper on Oracle database design and architecture

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close