{"id":77,"date":"2026-03-06T06:27:29","date_gmt":"2026-03-06T06:27:29","guid":{"rendered":"https:\/\/gigz.pk\/sql\/?post_type=lesson&#038;p=77"},"modified":"2026-03-16T18:50:38","modified_gmt":"2026-03-16T18:50:38","slug":"left-join","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/sql\/lesson\/left-join\/","title":{"rendered":"\u00a0LEFT JOIN"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A <strong>LEFT JOIN<\/strong> is used in SQL to combine rows from two tables. It returns all records from the <strong>left table<\/strong> and the matched records from the <strong>right table<\/strong>. If there is no match, the result will still include the left table\u2019s row, but the right table\u2019s columns will contain <strong>NULL<\/strong>.<\/p>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773567393374\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT columns<br>FROM left_table<br>LEFT JOIN right_table<br>ON left_table.common_column = right_table.common_column;<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Key Points<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <strong>left table<\/strong> is the table listed before <code>LEFT JOIN<\/code>.<\/li>\n\n\n\n<li>The <strong>right table<\/strong> is the table listed after <code>LEFT JOIN<\/code>.<\/li>\n\n\n\n<li>Rows from the left table are always included in the result.<\/li>\n\n\n\n<li>If no matching row exists in the right table, <code>NULL<\/code> is displayed for those columns.<\/li>\n\n\n\n<li>LEFT JOIN is useful when you want to include all data from one table, even if it doesn\u2019t have a related record in another table.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Suppose we have two tables:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Students<\/strong><br>ID | Name<br>1 | Alice<br>2 | Bob<br>3 | Carol<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Grades<\/strong><br>StudentID | Grade<br>1 | A<br>3 | B<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Query:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT Students.ID, Students.Name, Grades.Grade<br>FROM Students<br>LEFT JOIN Grades<br>ON Students.ID = Grades.StudentID;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Result:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">ID | Name | Grade<br>1 | Alice | A<br>2 | Bob | NULL<br>3 | Carol | B<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Explanation: Bob has no grade, so the result shows NULL in the Grade column.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">When to Use LEFT JOIN<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When you want all records from the main table even if related records are missing in another table.<\/li>\n\n\n\n<li>To detect missing relationships between tables.<\/li>\n\n\n\n<li>To combine optional information with mandatory data.<\/li>\n<\/ul>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/sql\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">SQL Foundations Program (SQL-101) > Basic Joins > LEFT JOIN<\/span><\/span><\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"menu_order":24,"template":"","class_list":["post-77","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u00a0LEFT JOIN - SQL Learning Hub<\/title>\n<meta name=\"description\" content=\"&quot;Learn SQL LEFT JOIN: Combine tables, include all left-table records, handle NULLs, and see examples with students and grades.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/sql\/lesson\/left-join\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u00a0LEFT JOIN - SQL Learning Hub\" \/>\n<meta property=\"og:description\" content=\"&quot;Learn SQL LEFT JOIN: Combine tables, include all left-table records, handle NULLs, and see examples with students and grades.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/sql\/lesson\/left-join\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Learning Hub\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-16T18:50:38+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/left-join\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/left-join\\\/\",\"name\":\"\u00a0LEFT JOIN - SQL Learning Hub\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/#website\"},\"datePublished\":\"2026-03-06T06:27:29+00:00\",\"dateModified\":\"2026-03-16T18:50:38+00:00\",\"description\":\"\\\"Learn SQL LEFT JOIN: Combine tables, include all left-table records, handle NULLs, and see examples with students and grades.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/left-join\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/left-join\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/left-join\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Foundations Program (SQL-101) > Basic Joins > LEFT JOIN\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/\",\"name\":\"SQL Learning Hub\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u00a0LEFT JOIN - SQL Learning Hub","description":"\"Learn SQL LEFT JOIN: Combine tables, include all left-table records, handle NULLs, and see examples with students and grades.","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:\/\/gigz.pk\/sql\/lesson\/left-join\/","og_locale":"en_US","og_type":"article","og_title":"\u00a0LEFT JOIN - SQL Learning Hub","og_description":"\"Learn SQL LEFT JOIN: Combine tables, include all left-table records, handle NULLs, and see examples with students and grades.","og_url":"https:\/\/gigz.pk\/sql\/lesson\/left-join\/","og_site_name":"SQL Learning Hub","article_modified_time":"2026-03-16T18:50:38+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/sql\/lesson\/left-join\/","url":"https:\/\/gigz.pk\/sql\/lesson\/left-join\/","name":"\u00a0LEFT JOIN - SQL Learning Hub","isPartOf":{"@id":"https:\/\/gigz.pk\/sql\/#website"},"datePublished":"2026-03-06T06:27:29+00:00","dateModified":"2026-03-16T18:50:38+00:00","description":"\"Learn SQL LEFT JOIN: Combine tables, include all left-table records, handle NULLs, and see examples with students and grades.","breadcrumb":{"@id":"https:\/\/gigz.pk\/sql\/lesson\/left-join\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/sql\/lesson\/left-join\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/sql\/lesson\/left-join\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/sql\/"},{"@type":"ListItem","position":2,"name":"SQL Foundations Program (SQL-101) > Basic Joins > LEFT JOIN"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/sql\/#website","url":"https:\/\/gigz.pk\/sql\/","name":"SQL Learning Hub","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/sql\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/sql\/wp-json\/wp\/v2\/lesson\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/sql\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/sql\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/sql\/wp-json\/wp\/v2\/media?parent=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}