[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-656137-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-656137-en":130},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","sql-joins-sql-join-types-and-examples","SQL Joins - SQL join types and examples","","SQL Joins explains how different JOIN operations combine rows from two tables, using practical sample tables (TableA and TableB) with primary key mappings. It covers inner joins as matching-only results, including both equality-based and non-equality comparisons, and describes natural joins as implicit equi-joins on shared column names. The document also demonstrates left, right, full outer variants, including exclusion-focused forms, and introduces cross joins for Cartesian combinations.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/sql-joins-sql-join-types-and-examples/656137/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/sql-joins-sql-join-types-and-examples/656137.png","ImageObject",300,407,{"name":42,"@type":43},"River Wang","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-30","2026-10-25",true,{"@type":52,"interactionType":53,"userInteractionCount":33},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What does an INNER JOIN return?","Question",{"text":62,"@type":63},"An INNER JOIN returns only the set of records that match in both TableA and TableB.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How is a NATURAL JOIN related to an inner equi-join?",{"text":67,"@type":63},"A NATURAL JOIN is an inner equi-join where the join columns are implicitly created using any matching column names between the two tables.",{"name":69,"@type":60,"acceptedAnswer":70},"What does a LEFT OUTER JOIN return when there is no match?",{"text":71,"@type":63},"A LEFT OUTER JOIN returns all records from TableA, and when there is no match in TableB, the TableB side appears as NULL.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},656137,1793051427,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":33,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":144,"read_time":145},1099514067438,"https://ap-avatar.wpscdn.com/avatar/100002539ee87300030?x-image-process=image/resize,m_fixed,w_180,h_180&k=1780474512215547542","SQL Joins  \nSource material from Code Project article by C.L. Moffatt and“Coding Horror” blog from 10/11/07  \nTypes of Joins  \n• Inner Join  \n• Natural Join  \n• Left (Outer) Join  \n• Right (Outer) Join  \n• (Full) Outer Join  \n• Left (Outer) Join Excluding Inner Join  \n• Right (Outer) Join Excluding Inner Join  \n• (Full) Outer Join Excluding Inner Join  \n• Cross Join  \n• Equi-Join  \nSample Tables  \nTableA  \n\n| PK | Value |\n| --- | --- |\n| 1 | FOX |\n| 2 | COP |\n| 3 | TAXI |\n| 6 | WASHINGTON |\n| 7 | DELL |\n| 5 | ARIZONA |\n| 4 | LINCOLN |\n| 10 | LUCENT |\n\nTableB  \n\n| PK | Value |\n| --- | --- |\n| 1 | TROT |\n| 2 | CAR |\n| 3 | CAB |\n| 6 | MONUMENT |\n| 7 | PC |\n| 8 | MICROSOFT |\n| 9 | APPLE |\n| 11 | SCOTCH |\n\nInner Join  \n• Inner join produces only the set of records that match in both Table A and Table B  \n• Most commonly used, best understood join  \nInner Join  \n\n| TableA Value | PK | TableBPK | Value |\n| --- | --- | --- | --- |\n| FOX | 1 | 1 | TROT |\n| COP | 2 | 2 | CAR |\n| TAXI | 3 | 3 | CAB |\n| WASHINGTON | 6 | 6 | MONUMENT |\n| DELL | 7 | 7 | PC |\n\nSELECT * FROM TableA INNER JOIN TableB ON TableA.PK = TableB.PK  \n• This is the same as doing  \nSELECT * FROM TableA, TableB WHERE TableA.PK = TableB.PK  \nInner Join (continued)  \n• Inner Joins do not have to use equality to join the fields  \n• Can use \u003C, >, \u003C>  \nInner Join (continued)  \nSELECT * FROM TableA INNER JOIN TableB ON  \nTableA.PK >  \nTableB.PK  \n\n| TableAPK | Value | TableBPK | Value |\n| --- | --- | --- | --- |\n| 2 | COP | 1 | TROT |\n| 3 | TAXI | 1 | TROT |\n| 3 | TAXI | 2 | CAR |\n| 4 | LINCOLN | 1 | TROT |\n| 4 | LINCOLN | 2 | CAR |\n| 4 | LINCOLN | 3 | CAB |\n| 5 | ARIZONA | 1 | TROT |\n| 5 | ARIZONA | 2 | CAR |\n| 5 | ARIZONA | 3 | CAB |\n| … | More… | Rows… |  |\n\nInner Join/Natural Join  \n• A NATURAL join is just an inner equi-join where the join is implicitly created using any matching columns between the two tables  \n• Example:  \n• SELECT * FROM TableA NATURAL JOIN TableB  \n• Same results as inner equi-join?  \n• Which columns match?  \nLeft Outer Join  \n• Left outer join produces a complete set of records from Table A, with the matching records  \n(where available) in Table B. If there is no match, the right side will contain null.  \nLeft Outer Join  \n\n| TableA Value | PK | TableBPK | Value |\n| --- | --- | --- | --- |\n| FOX | 1 | 1 | TROT |\n| COP | 2 | 2 | CAR |\n| TAXI | 3 | 3 | CAB |\n| LINCOLN | 4 | NULL | NULL |\n| ARIZONA | 5 | NULL | NULL |\n| WASHINGTON | 6 | 6 | MONUMENT |\n| DELL | 7 | 7 | PC |\n| LUCENT | 10 | NULL | NULL |\n\n• SELECT * FROM TableA LEFT OUTER JOIN TableBON TableA.PK = TableB.PK","cbCaigmLFHeQTg30","https://ap.wps.com/l/cbCaigmLFHeQTg30","pdf",814137,23,"English","# Types of Joins\n## Inner Join\n## Inner Join (continued)\n## Inner Join/Natural Join\n## Left Outer Join","[{\"question\":\"What does an INNER JOIN return?\",\"answer\":\"An INNER JOIN returns only the set of records that match in both TableA and TableB.\"},{\"question\":\"How is a NATURAL JOIN related to an inner equi-join?\",\"answer\":\"A NATURAL JOIN is an inner equi-join where the join columns are implicitly created using any matching column names between the two tables.\"},{\"question\":\"What does a LEFT OUTER JOIN return when there is no match?\",\"answer\":\"A LEFT OUTER JOIN returns all records from TableA, and when there is no match in TableB, the TableB side appears as NULL.\"}]","SQL Joins - SQL join types and examples | PDF",1792966687,58]