{"id":76,"date":"2026-03-06T06:26:09","date_gmt":"2026-03-06T06:26:09","guid":{"rendered":"https:\/\/gigz.pk\/sql\/?post_type=lesson&#038;p=76"},"modified":"2026-03-16T18:50:24","modified_gmt":"2026-03-16T18:50:24","slug":"inner-join","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/sql\/lesson\/inner-join\/","title":{"rendered":"INNER JOIN"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is INNER JOIN?<\/h2>\n\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773567130359\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n\n<p class=\"wp-block-paragraph\">An <strong>INNER JOIN<\/strong> is a type of SQL join that returns only the rows that have matching values in both tables. It is used to combine data from two or more tables based on a related column.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Syntax of INNER JOIN<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT columns<br>FROM table1<br>INNER JOIN table2<br>ON table1.column = table2.column;<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>table1, table2<\/strong> \u2013 Names of the tables you want to join.<\/li>\n\n\n\n<li><strong>column<\/strong> \u2013 The common column used to match records in both tables.<\/li>\n\n\n\n<li><strong>columns<\/strong> \u2013 The list of columns you want to display in the result.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How INNER JOIN Works<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>SQL looks for matching values in the specified columns of both tables.<\/li>\n\n\n\n<li>Only rows that satisfy the matching condition are returned.<\/li>\n\n\n\n<li>Rows with no match in either table are excluded.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Example 1: Basic INNER JOIN<\/h2>\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>Customers<\/strong><br>CustomerID, Name<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Orders<\/strong><br>OrderID, CustomerID, OrderDate<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We want a list of customers with their orders:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT Customers.Name, Orders.OrderID, Orders.OrderDate<br>FROM Customers<br>INNER JOIN Orders<br>ON Customers.CustomerID = Orders.CustomerID;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Result:<\/strong><br>Only customers who have placed an order will appear in the result. Customers without orders are excluded.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example 2: INNER JOIN with Multiple Columns<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You can join on more than one column if necessary:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT A.Name, B.OrderID<br>FROM Customers A<br>INNER JOIN Orders B<br>ON A.CustomerID = B.CustomerID AND A.Region = B.Region;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will return rows where both CustomerID and Region match in both tables.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Key Points to Remember<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>INNER JOIN only returns <strong>matching rows<\/strong>.<\/li>\n\n\n\n<li>If no match exists, the row is not included.<\/li>\n\n\n\n<li>Multiple INNER JOINs can be used to join more than two tables.<\/li>\n\n\n\n<li>Aliases (like A and B) can simplify queries with long table names.<\/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 > INNER JOIN<\/span><\/span><\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"menu_order":24,"template":"","class_list":["post-76","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>INNER JOIN - SQL Learning Hub<\/title>\n<meta name=\"description\" content=\"Learn SQL INNER JOIN with examples. Understand how to combine tables, match rows, and write efficient queries step by step.\" \/>\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\/inner-join\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"INNER JOIN - SQL Learning Hub\" \/>\n<meta property=\"og:description\" content=\"Learn SQL INNER JOIN with examples. Understand how to combine tables, match rows, and write efficient queries step by step.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/sql\/lesson\/inner-join\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Learning Hub\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-16T18:50:24+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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/inner-join\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/inner-join\\\/\",\"name\":\"INNER JOIN - SQL Learning Hub\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/#website\"},\"datePublished\":\"2026-03-06T06:26:09+00:00\",\"dateModified\":\"2026-03-16T18:50:24+00:00\",\"description\":\"Learn SQL INNER JOIN with examples. Understand how to combine tables, match rows, and write efficient queries step by step.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/inner-join\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/inner-join\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/inner-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 > INNER 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":"INNER JOIN - SQL Learning Hub","description":"Learn SQL INNER JOIN with examples. Understand how to combine tables, match rows, and write efficient queries step by step.","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\/inner-join\/","og_locale":"en_US","og_type":"article","og_title":"INNER JOIN - SQL Learning Hub","og_description":"Learn SQL INNER JOIN with examples. Understand how to combine tables, match rows, and write efficient queries step by step.","og_url":"https:\/\/gigz.pk\/sql\/lesson\/inner-join\/","og_site_name":"SQL Learning Hub","article_modified_time":"2026-03-16T18:50:24+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/sql\/lesson\/inner-join\/","url":"https:\/\/gigz.pk\/sql\/lesson\/inner-join\/","name":"INNER JOIN - SQL Learning Hub","isPartOf":{"@id":"https:\/\/gigz.pk\/sql\/#website"},"datePublished":"2026-03-06T06:26:09+00:00","dateModified":"2026-03-16T18:50:24+00:00","description":"Learn SQL INNER JOIN with examples. Understand how to combine tables, match rows, and write efficient queries step by step.","breadcrumb":{"@id":"https:\/\/gigz.pk\/sql\/lesson\/inner-join\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/sql\/lesson\/inner-join\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/sql\/lesson\/inner-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 > INNER 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\/76","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=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}