• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Outer Joins

You use outer joins when you want the records on the one side of a one-to-many relationship to be included in the query result, regardless of whether there are matching records in the table on the many side. With a Customers table and an Orders table, for example, users often want to include only customers with orders in the query output. An inner join (the default join type) does this. In other situations, users want all customers to be included in the query result, whether or not they have orders. This is when an outer join is necessary.

NOTE

There are two types of outer joins: left outer joins and right outer joins. A left outer join occurs when all records on the one side of a one-to-many relationship are included in the query result, regardless of whether any records exist on the many side. A right outer join means all records on the many side of a one-to-many relationship are included in the query result, regardless of whether there are any records on the one side. A right outer join should never occur if you are enforcing referential integrity.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint