[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-1-en-105":3,"doc-seo-573230-105":53,"doc-detail-573230-en":126},{"code":4,"msg":5,"data":6},0,"success",[7,14,19,24,29,34,39,44,49],{"id":8,"doc_module":9,"doc_module_name":10,"category_name":11,"show_sort_weight":12,"slug":13},11,1,"Template","Presentations",90,"presentations",{"id":15,"doc_module":9,"doc_module_name":10,"category_name":16,"show_sort_weight":17,"slug":18},12,"Resumes",80,"resumes",{"id":20,"doc_module":9,"doc_module_name":10,"category_name":21,"show_sort_weight":22,"slug":23},14,"Invoices",70,"invoices",{"id":25,"doc_module":9,"doc_module_name":10,"category_name":26,"show_sort_weight":27,"slug":28},15,"Posters",60,"posters",{"id":30,"doc_module":9,"doc_module_name":10,"category_name":31,"show_sort_weight":32,"slug":33},16,"Social Media",50,"social-media",{"id":35,"doc_module":9,"doc_module_name":10,"category_name":36,"show_sort_weight":37,"slug":38},17,"Forms",40,"forms",{"id":40,"doc_module":9,"doc_module_name":10,"category_name":41,"show_sort_weight":42,"slug":43},18,"Letters",30,"letters",{"id":45,"doc_module":9,"doc_module_name":10,"category_name":46,"show_sort_weight":47,"slug":48},21,"Paper Templates",5,"papers-templates",{"id":50,"doc_module":9,"doc_module_name":10,"category_name":51,"show_sort_weight":4,"slug":52},158,"General","general-158",{"code":4,"msg":54,"data":55},"ok",{"site_id":56,"language":57,"slug":58,"title":59,"keywords":60,"description":61,"schema_data":62,"social_meta":119,"head_meta":121,"extra_data":123,"updated_unix":125},105,"en","sql-joins-cheat-sheet-practical-guide","SQL JOINs Cheat Sheet - Practical Guide","","SQL JOINs Cheat Sheet provides a concise, example-driven reference for combining rows across related tables. It explains primary keys and foreign keys, then details INNER JOIN, NATURAL JOIN, LEFT/RIGHT/FULL OUTER JOIN, and CROSS JOIN semantics, including how unmatched rows are handled and when NULLs appear. The sheet also covers JOIN conditions beyond equality, plus column and table aliases, self joins, non-equijoin patterns, and multi-table joins with example SQL queries.",{"@graph":63,"@context":118},[64,80,101],{"@type":65,"itemListElement":66},"BreadcrumbList",[67,71,74,77],{"item":68,"name":69,"@type":70,"position":9},"https://docshare.wps.com","Home","ListItem",{"item":72,"name":10,"@type":70,"position":73},"https://docshare.wps.com/template/",2,{"item":75,"name":11,"@type":70,"position":76},"https://docshare.wps.com/template/presentations/",3,{"item":78,"name":59,"@type":70,"position":79},"https://docshare.wps.com/template/sql-joins-cheat-sheet-practical-guide/573230/",4,{"url":78,"name":59,"@type":81,"image":82,"author":87,"headline":59,"publisher":90,"fileFormat":93,"inLanguage":57,"description":61,"dateModified":94,"datePublished":95,"encodingFormat":93,"isAccessibleForFree":96,"interactionStatistic":97},"DigitalDocument",{"url":83,"@type":84,"width":85,"height":86},"https://docshare.wps.com/thumbnails/sql-joins-cheat-sheet-practical-guide/573230.png","ImageObject",442,249,{"name":88,"@type":89},"Alex Sinclair","Person",{"url":68,"name":91,"@type":92},"DocShare","Organization","application/pdf","2026-10-18","2026-10-13",true,{"@type":98,"interactionType":99,"userInteractionCount":79},"InteractionCounter",{"@type":100},"ViewAction",{"@type":102,"mainEntity":103},"FAQPage",[104,110,114],{"name":105,"@type":106,"acceptedAnswer":107},"What is the difference between INNER JOIN and JOIN in general?","Question",{"text":108,"@type":109},"JOIN returns all rows that match the ON condition, and it is also called INNER JOIN. Non-matching rows are not included in the result.","Answer",{"name":111,"@type":106,"acceptedAnswer":112},"How do LEFT JOIN and RIGHT JOIN handle rows without matches?",{"text":113,"@type":109},"LEFT JOIN returns all rows from the left table and matches from the right table; non-matching right-side rows are filled with NULLs. RIGHT JOIN mirrors this by keeping all rows from the right table and filling NULLs for non-matching left-side rows.",{"name":115,"@type":106,"acceptedAnswer":116},"What is a self join and when would you use it?",{"text":117,"@type":109},"A self join joins a table to itself, using different aliases to show relationships such as parent-child within the same table. Each occurrence of the table must use a different alias, and column references must include the appropriate alias.","https://schema.org",{"og:url":78,"og:type":120,"og:title":59,"og:site_name":91,"og:description":61},"article",{"robots":122,"canonical":78},"index,follow",{"doc_id":124,"site_id":56},573230,1792023128,{"code":4,"msg":5,"data":127},{"doc_id":124,"user_id":128,"nickname":88,"user_avatar":129,"doc_module":9,"category_id":8,"category_name":11,"doc_title":59,"doc_description":61,"doc_content":130,"file_id":131,"file_url":132,"file_type":133,"file_size":134,"view_count":79,"is_deleted":4,"is_public":9,"is_downloadable":9,"audit_status":9,"page_count":73,"language":135,"language_code":57,"site_id":56,"html_lang":57,"table_of_contents":136,"faqs":137,"seo_title":138,"seo_description":61,"update_tm":139,"read_time":9},1099523882182,"https://ap-avatar.wpscdn.com/davatar_6f874abed73319feea01a86fa6f0fab8","SQL JOINs Cheat Sheet  \nJOINING TABLES  \nJOIN combines data from two tables.  \nJOIN typically combines rows with equal values for the specified columns. Usually, one table contains a primary key, which is a column or columns that uniquely identify rows in the table (the cat_id column in the cat table) .  \nThe other table has a column or columns that refer to the primary key columns in the first table (the cat_id column in the toy table). Such columns are foreign keys. The JOIN condition is the equality between the primary key columns in one table and columns referring to them in the other table.  \nJOIN  \nJOIN returns all rows that match the ON condition. JOIN is also called INNER JOIN.  \nSELECT * FROM toy JOIN cat  \nON [toy.cat_id = cat.cat_id](toy.cat_id = cat.cat_id) ;  \nThere is also another, older syntax, but it isn't recommended.  \nList joined tables in the FROM clause, and place the conditions in the WHERE clause.  \nSELECT *  \nFROM toy, cat  \nWHERE [toy.cat_id = cat.cat_id](toy.cat_id = cat.cat_id) ;  \nJOIN CONDITIONS  \nThe JOIN condition doesn't have to be an equality – it can be any condition you want. JOIN doesn't interpret the JOIN condition, it only checks if the rows satisfy the given condition.  \nTo refer to a column in the JOIN query, you have to use the full column name: first the table name, then a dot ( .) and the column name:  \nON cat.cat_id = [toy.cat](toy.cat)_id  \nYou can omit the table name and use just the column name if the name of the column is unique within all columns in the joined tables.  \nNATURAL JOIN  \nIf the tables have columns with the same name, you can use NATURAL JOIN instead of JOIN.  \nSELECT * FROM toy  \nNATURAL JOIN cat;  \nThe common column appears only once in the result table. Note: NATURAL JOIN is rarely used in real life.  \nLEFT JOIN  \nLEFT JOIN returns all rows from the left table with matching rows from the right table. Rows without a match are filled with NULLs. LEFT JOIN is also called LEFT OUTER JOIN.  \nSELECT * FROM toy LEFT JOIN cat  \nON [toy.cat_id = cat.cat_id](toy.cat_id = cat.cat_id) ;  \nRIGHT JOIN  \nRIGHT JOIN returns all rows from the right table with matching rows from the left table. Rows without a match are filled with NULLs. RIGHT JOIN is also called RIGHT OUTER JOIN.  \nSELECT *  \nFROM toy RIGHT JOIN cat  \nON [toy.cat_id = cat.cat_id](toy.cat_id = cat.cat_id) ;  \nFULL JOIN  \nFULL JOIN returns all rows from the left table and all rows from the right table. It fills the non-matching rows with  \nNULLs. FULL JOIN is also called FULL OUTER JOIN.  \nSELECT * FROM toy FULL JOIN cat  \nON [toy.cat_id = cat.cat_id](toy.cat_id = cat.cat_id) ;  \nCROSS JOIN  \nCROSS JOIN returns all possible combinations of rows from the left and right tables.  \nSELECT * FROM toy  \nCROSS JOIN cat; Other syntax: SELECT *  \nFROM toy, cat;  \nTry out the interactive SQL JOINs course at [LearnSQL.com](LearnSQL.com), and check out our other SQL courses.  \nLearnSQL.com is owned by Vertabelo[vertabelo.com | CC BY-NC-ND Vertabelo](vertabelo.com | CC BY-NC-ND Vertabelo)  \nSA  \nSA  \nSQL JOINs Cheat Sheet  \nCOLUMN AND TABLE ALIASES  \nAliases give a temporary name to a table or a column in a table.  \n\n| OWNER AS o |  |\n| --- | --- |\n| id | name |\n| 1 | John Smith |\n| 2 | Danielle Davis |\n\n\n| CAT AS c |  |  |  |\n| --- | --- | --- | --- |\n| cat_id | cat   name | mom_id | owner_id |\n| 1 | Kitty | 5 | 1 |\n| 2 | Hugo | 1 | 2 |\n| 3 | Sam | 2 | 2 |\n| 4 | Misty | 1 | NULL |\n\nA column alias renames a column in the result. A table alias renames a table within the query. If you define a table alias, you must use it instead of the table name everywhere in the query. The AS keyword is optional in defining aliases.  \nSELECT  \n[o](o.name)[.name](o.name) AS owner_name, [c](c.cat_name)[.cat_name](c.cat_name)  \nFROM cat AS c  \nJOIN owner AS o  \nON c .owner_id = o .id;  \n\n| cat   name | owner  name |\n| --- | --- |\n| Kitty | John Smith |\n| Sam | Danielle Davis |\n| Hugo | Danielle Davis |\n\nSELF JOIN  \nYou can join a table to itself,","cbCaiglvW7pGXYWR","https://ap.wps.com/l/cbCaiglvW7pGXYWR","pdf",125298,"English","# JOINing tables\n## JOIN and JOIN conditions\n## NATURAL JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN, CROSS JOIN\n# Column and table aliases\n## Using AS with aliases\n# Self join patterns\n## Self join and non-equi self join\n## Multiple joins","[{\"question\":\"What is the difference between INNER JOIN and JOIN in general?\",\"answer\":\"JOIN returns all rows that match the ON condition, and it is also called INNER JOIN. Non-matching rows are not included in the result.\"},{\"question\":\"How do LEFT JOIN and RIGHT JOIN handle rows without matches?\",\"answer\":\"LEFT JOIN returns all rows from the left table and matches from the right table; non-matching right-side rows are filled with NULLs. RIGHT JOIN mirrors this by keeping all rows from the right table and filling NULLs for non-matching left-side rows.\"},{\"question\":\"What is a self join and when would you use it?\",\"answer\":\"A self join joins a table to itself, using different aliases to show relationships such as parent-child within the same table. Each occurrence of the table must use a different alias, and column references must include the appropriate alias.\"}]","SQL JOINs Cheat Sheet - Practical Guide | PDF",1791935273]