{"id":1227,"date":"2012-12-05T10:00:05","date_gmt":"2012-12-05T15:00:05","guid":{"rendered":"http:\/\/sqlity.net\/en\/?p=1227"},"modified":"2014-11-13T13:53:52","modified_gmt":"2014-11-13T18:53:52","slug":"a-join-a-day-the-left-outer-join","status":"publish","type":"post","link":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/","title":{"rendered":"A Join A Day \u2013 The Left Outer Join"},"content":{"rendered":"<div>\n<h3>Introduction<\/h3>\n<p>\nThis is the fifth post in my <a href=\"http:\/\/sqlity.net\/en\/1146\/a-join-a-day-introduction\">A Join A Day<\/a> series about SQL Server Joins. Make sure to let me know how I am doing or ask your burning join related questions by leaving a comment below.\n<\/p>\n<p>\nAn inner join will only return rows from either row source for which a match in the other row source exists. A left outer join on the other hand will always return all rows of the left row source. The left row source is the one that is placed before the <span class=\"tt\">JOIN<\/span> keyword in the query. The right row source is the one that comes after the <span class=\"tt\">JOIN<\/span> keyword.\n<\/p>\n<h3>LEFT OUTER JOIN Example<\/h3>\n<p>\nLet's assume you need to return all AdressType records from the AdventureWorks2008R2 database and for each one all BusinessEntityAddress records of that type. But if there is a type for which no records in BusinessEntityAddress exist, you still want to see a row in the result set. In a case like this you can use a left outer join such as the following:\n<\/p>\n<div>\n[sql]\nSELECT at.Name AS AddressTypeName, bea.BusinessEntityID, bea.AddressID<br \/>\nFROM Person.AddressType at<br \/>\nLEFT JOIN Person.BusinessEntityAddress bea<br \/>\nON at.AddressTypeID = bea.AddressTypeID<br \/>\nORDER BY at.AddressTypeID, bea.BusinessEntityID;<br \/>\n[\/sql]\n<\/div>\n<p>\nThis query produces the following result:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg\" alt=\"left outer join example\" title=\"left outer join example\" width=\"1093\" height=\"577\" class=\"aligncenter size-full wp-image-1232\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg 1093w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example-300x158.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example-1024x540.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example-150x79.jpg 150w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><\/a>\n<\/p>\n<p>\nThe BusinessEntityAddress table contains 19614 records. Each of those addresses is of a specific type. However, only addresses of three different types are currently in the table. The AddressType Table on the other hand has six records. When running the query above, the three used types will be joined to the 19614 addresses producing 19614 rows. The remaining three AddressType records will be returned as well in separate rows resulting in 19617 total rows.\n<\/p>\n<p>\nFor rows of the left side (AddressType) that do not have a match in the right side (BusinessEntityAddress) the final result set will have the right side columns valued NULL. You can see an example of that in the first row of the result in above image.\n<\/p>\n<p>\nTo clearly point out the exact difference between an inner join and a left outer join I am going to use the table pair I introduced on day two in the post about the <a href=\"http:\/\/sqlity.net\/en\/1163\/a-join-a-day-the-inner-join\/\">inner join<\/a>.\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/all-cases-join-example-setup.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/all-cases-join-example-setup.jpg\" alt=\"setup for all-cases join example\" title=\"setup for all-cases join example\" width=\"1093\" height=\"656\" class=\"aligncenter size-full wp-image-1234\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/all-cases-join-example-setup.jpg 1093w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/all-cases-join-example-setup-300x180.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/all-cases-join-example-setup-1024x614.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/all-cases-join-example-setup-150x90.jpg 150w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><\/a>\n<\/p>\n<p>\nThis time we are going to execute the following left outer join query:\n<\/p>\n<div>\n[sql]\nSELECT *<br \/>\nFROM dbo.TblA AS A<br \/>\nLEFT OUTER JOIN dbo.TblB AS B<br \/>\nON A.TblA_Val = B.TblB_Val;<br \/>\n[\/sql]\n<\/div>\n<p>\nThe result is shown below:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/left-outer-join-full-example.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/left-outer-join-full-example.jpg\" alt=\"all-cases example for left outer join\" title=\"all-cases example for left outer join\" width=\"1093\" height=\"579\" class=\"aligncenter size-full wp-image-1229\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/left-outer-join-full-example.jpg 1093w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/left-outer-join-full-example-300x158.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/left-outer-join-full-example-1024x542.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/left-outer-join-full-example-150x79.jpg 150w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><\/a>\n<\/p>\n<p>\nRows for which matches on both sides exists are treated exactly like they would be treated in an inner join query. The only difference is that rows from the left side that do not have a match on the right side are returned as well. In that case the right side columns are all valued NULL. The row for <span class=\"tt\">TblA_Val = 1<\/span> shows an example of this.\n<\/p>\n<h3>LEFT OUTER JOIN Syntax<\/h3>\n<p>\nThe <span class=\"tt\">OUTER<\/span> keyword in above example query is optional. Typing <span class=\"tt\">LEFT JOIN<\/span> will yied the same results.\n<\/p>\n<p>\nAs with the inner join, the <span class=\"tt\">ON<\/span> clause defines the condition which records from the two sides need to fulfill to be considered a match. However, in the case of a <span class=\"tt\">LEFT OUTER JOIN<\/span> it is very important that the entire condition is specified in the <span class=\"tt\">ON<\/span> clause. If parts of it end up in the <span class=\"tt\">WHERE<\/span> clause instead, you will get unexpected results.\n<\/p>\n<p>\nTake for example products and reviews. Let's write a query that returns all products and with them the reviewer and the review date of all five star reviews. We would write a query like this:\n<\/p>\n<div>\n[sql]\nSELECT  p.Name,<br \/>\n        p.ProductNumber,<br \/>\n        p.ListPrice,<br \/>\n        p.SellStartDate,<br \/>\n        pr.ReviewerName,<br \/>\n        pr.ReviewDate<br \/>\nFROM Production.Product AS p<br \/>\nLEFT OUTER JOIN Production.ProductReview AS pr<br \/>\nON p.ProductID = pr.ProductID<br \/>\nAND pr.Rating = 5<br \/>\nORDER BY pr.ReviewDate DESC, p.SellStartDate DESC;<br \/>\n[\/sql]\n<\/div>\n<p>\nAdventureWorks clearly needs to work on their product quality. Only two of the 504 product have a five star review:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-products-with-their-five-star-review-date.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-products-with-their-five-star-review-date.jpg\" alt=\"List of products with their five star review date\" title=\"List of products with their five star review date\" width=\"1093\" height=\"577\" class=\"aligncenter size-full wp-image-1231\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-products-with-their-five-star-review-date.jpg 1093w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-products-with-their-five-star-review-date-300x158.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-products-with-their-five-star-review-date-1024x540.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-products-with-their-five-star-review-date-150x79.jpg 150w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><\/a>\n<\/p>\n<p>\nIf we were to move the part that specified that the rating need to be a five star rating into the <span class=\"tt\">WHERE<\/span> clause the result changes dramatically:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-five-star-rated-products.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-five-star-rated-products.jpg\" alt=\"List of five star rated products\" title=\"List of five star rated products\" width=\"1093\" height=\"577\" class=\"aligncenter size-full wp-image-1230\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-five-star-rated-products.jpg 1093w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-five-star-rated-products-300x158.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-five-star-rated-products-1024x540.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/List-of-five-star-rated-products-150x79.jpg 150w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><\/a>\n<\/p>\n<p>\nThe reason is that we changed the question we asked with the query. The first query represents a question like this: \"Give me a list of all products. With each product return also the reviewers name and the review date of all their five star reviews.\"\n<\/p>\n<p>\nThe second query on the other hand represents a question more like this: \"Create a list of all products together with information about all their reviews. Of that list return only the records that contain a five star review.\"\n<\/p>\n<p>\nSo, if a product does not have a five star review, it will be completely filtered out by the where clause of the second query. This effectively turns the left outer join back into an inner join. So it is very important to include the entire join condition in the <span class=\"tt\">ON<\/span> clause.\n<\/p>\n<p>\nBecause it is so important in outer join cases, it is a good practice to always specify the entire match condition after the <span class=\"tt\">ON<\/span> clause even in cases like a standard inner join where it is technically not necessary. That makes reading and understanding the code easier and prevents hard to discover bugs later if for example an inner join has to be changed to an outer join because of a new business requirement.\n<\/p>\n<h3>LEFT OUTER JOIN Operator<\/h3>\n<p>\nAs with the inner join, there are three algorithms for SQL Server to choose from when a left outer join is requested. SQL Server makes the decision of which one to use based on statistics and row count estimates. The image below shows the Nested Loops (Left Outer Join) operator that was used for the query in the example section above.\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Execution-Plan.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Execution-Plan.jpg\" alt=\"Left Outer Join Execution Plan\" title=\"Left Outer Join Execution Plan\" width=\"1093\" height=\"577\" class=\"aligncenter size-full wp-image-1228\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Execution-Plan.jpg 1093w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Execution-Plan-300x158.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Execution-Plan-1024x540.jpg 1024w, https:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Execution-Plan-150x79.jpg 150w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><\/a>\n<\/p>\n<\/p>\n<h3>Summary<\/h3>\n<p>\nThe left outer join allows for retrieval of all records of the left row source. If there are matching rows coming from the right row source, a single row for each match will be returned.  All rows from the left side that do not have a match on the right side will be returned as anyway; their right side values will be set to NULL.\n<\/p>\n<h3>A Join A Day<\/h3>\n<p>\nThis post is part of my December 2012 \"A Join A Day\" blog post series. You can find the table of contents with all posts published so far in the introductory post: <a href=\"http:\/\/sqlity.net\/en\/1146\/a-join-a-day-introduction\/\">A Join A Day \u2013 Introduction<\/a>. Check back there frequently throughout the month.\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this fifth post of my A Join A Day series we are going to examine the left outer join. Learn about the difference to an inner join, the importance of the ON clause and take a look at the left join operator used in execution plans.<\/p>\n<p> <a href=\"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/\">[more&#8230;]<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[28,5,27,23],"tags":[],"class_list":["post-1227","post","type-post","status-publish","format-standard","hentry","category-a-join-a-day","category-general","category-series","category-t-sql-statements"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>A Join A Day \u2013 The Left Outer Join - sqlity.net<\/title>\n<meta name=\"description\" content=\"In this fifth post of my A Join A Day series we are going to examine the left outer join. Learn about the difference to an inner join, the importance of the ON clause and take a look at the left join operator used in execution plans.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A Join A Day \u2013 The Left Outer Join - sqlity.net\" \/>\n<meta property=\"og:description\" content=\"In this fifth post of my A Join A Day series we are going to examine the left outer join. Learn about the difference to an inner join, the importance of the ON clause and take a look at the left join operator used in execution plans.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/\" \/>\n<meta property=\"og:site_name\" content=\"sqlity.net\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sqlity.net\" \/>\n<meta property=\"article:published_time\" content=\"2012-12-05T15:00:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-11-13T18:53:52+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg\" \/>\n<meta name=\"author\" content=\"Sebastian Meine\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sqlity\" \/>\n<meta name=\"twitter:site\" content=\"@sqlity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sebastian Meine\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/\"},\"author\":{\"name\":\"Sebastian Meine\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"headline\":\"A Join A Day \u2013 The Left Outer Join\",\"datePublished\":\"2012-12-05T15:00:05+00:00\",\"dateModified\":\"2014-11-13T18:53:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/\"},\"wordCount\":1102,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/12\\\/Left-Outer-Join-Example.jpg\",\"articleSection\":[\"A Join A Day\",\"General\",\"Series\",\"T-SQL Statements\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/\",\"name\":\"A Join A Day \u2013 The Left Outer Join - sqlity.net\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/12\\\/Left-Outer-Join-Example.jpg\",\"datePublished\":\"2012-12-05T15:00:05+00:00\",\"dateModified\":\"2014-11-13T18:53:52+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"description\":\"In this fifth post of my A Join A Day series we are going to examine the left outer join. Learn about the difference to an inner join, the importance of the ON clause and take a look at the left join operator used in execution plans.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/#primaryimage\",\"url\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/12\\\/Left-Outer-Join-Example.jpg\",\"contentUrl\":\"http:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2012\\\/12\\\/Left-Outer-Join-Example.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/1227\\\/a-join-a-day-the-left-outer-join\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A Join A Day \u2013 The Left Outer Join\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\",\"name\":\"sqlity.net\",\"description\":\"Quality for SQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sqlity.net\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\",\"name\":\"Sebastian Meine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"caption\":\"Sebastian Meine\"},\"sameAs\":[\"http:\\\/\\\/sqlity.net\",\"https:\\\/\\\/x.com\\\/sqlity\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A Join A Day \u2013 The Left Outer Join - sqlity.net","description":"In this fifth post of my A Join A Day series we are going to examine the left outer join. Learn about the difference to an inner join, the importance of the ON clause and take a look at the left join operator used in execution plans.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/","og_locale":"en_US","og_type":"article","og_title":"A Join A Day \u2013 The Left Outer Join - sqlity.net","og_description":"In this fifth post of my A Join A Day series we are going to examine the left outer join. Learn about the difference to an inner join, the importance of the ON clause and take a look at the left join operator used in execution plans.","og_url":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/","og_site_name":"sqlity.net","article_publisher":"https:\/\/www.facebook.com\/sqlity.net","article_published_time":"2012-12-05T15:00:05+00:00","article_modified_time":"2014-11-13T18:53:52+00:00","og_image":[{"url":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg","type":"","width":"","height":""}],"author":"Sebastian Meine","twitter_card":"summary_large_image","twitter_creator":"@sqlity","twitter_site":"@sqlity","twitter_misc":{"Written by":"Sebastian Meine","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/#article","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/"},"author":{"name":"Sebastian Meine","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"headline":"A Join A Day \u2013 The Left Outer Join","datePublished":"2012-12-05T15:00:05+00:00","dateModified":"2014-11-13T18:53:52+00:00","mainEntityOfPage":{"@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/"},"wordCount":1102,"commentCount":1,"image":{"@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/#primaryimage"},"thumbnailUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg","articleSection":["A Join A Day","General","Series","T-SQL Statements"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/","url":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/","name":"A Join A Day \u2013 The Left Outer Join - sqlity.net","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/#primaryimage"},"image":{"@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/#primaryimage"},"thumbnailUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg","datePublished":"2012-12-05T15:00:05+00:00","dateModified":"2014-11-13T18:53:52+00:00","author":{"@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"description":"In this fifth post of my A Join A Day series we are going to examine the left outer join. Learn about the difference to an inner join, the importance of the ON clause and take a look at the left join operator used in execution plans.","breadcrumb":{"@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/#primaryimage","url":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg","contentUrl":"http:\/\/sqlity.net\/wp-content\/uploads\/2012\/12\/Left-Outer-Join-Example.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/sqlity.net\/en\/1227\/a-join-a-day-the-left-outer-join\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sqlity.net\/en\/"},{"@type":"ListItem","position":2,"name":"A Join A Day \u2013 The Left Outer Join"}]},{"@type":"WebSite","@id":"https:\/\/sqlity.net\/en\/#website","url":"https:\/\/sqlity.net\/en\/","name":"sqlity.net","description":"Quality for SQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sqlity.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c","name":"Sebastian Meine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","caption":"Sebastian Meine"},"sameAs":["http:\/\/sqlity.net","https:\/\/x.com\/sqlity"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXuw-jN","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/1227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/comments?post=1227"}],"version-history":[{"count":0,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/1227\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/media?parent=1227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/categories?post=1227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/tags?post=1227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}