{"id":67,"date":"2026-03-06T06:10:42","date_gmt":"2026-03-06T06:10:42","guid":{"rendered":"https:\/\/gigz.pk\/sql\/?post_type=lesson&#038;p=67"},"modified":"2026-03-16T18:49:10","modified_gmt":"2026-03-16T18:49:10","slug":"between","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/sql\/lesson\/between\/","title":{"rendered":"BETWEEN"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>BETWEEN<\/code> operator is used in databases and programming to filter data within a specific range. It helps you select values that fall between two defined limits.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT column_name<br>FROM table_name<br>WHERE column_name BETWEEN value1 AND value2;<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>column_name<\/strong> \u2013 the field you want to filter<\/li>\n\n\n\n<li><strong>table_name<\/strong> \u2013 the table containing the data<\/li>\n\n\n\n<li><strong>value1<\/strong> \u2013 the lower limit of the range<\/li>\n\n\n\n<li><strong>value2<\/strong> \u2013 the upper limit of the range<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The <code>BETWEEN<\/code> operator includes both the lower and upper limits.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Examples<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Numbers<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT * <br>FROM Employees<br>WHERE Age BETWEEN 25 AND 35;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This query retrieves all employees whose age is between 25 and 35, inclusive.<\/p>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Dates<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT * <br>FROM Orders<br>WHERE OrderDate BETWEEN '2026-01-01' AND '2026-03-01';<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This query retrieves orders placed between January 1, 2026, and March 1, 2026.<\/p>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Text<\/strong><br>Some databases allow <code>BETWEEN<\/code> with text to filter alphabetically.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT * <br>FROM Products<br>WHERE ProductName BETWEEN 'A' AND 'M';<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This query retrieves products with names starting from A to M.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Important Points<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>BETWEEN<\/code> is inclusive of the boundary values.<\/li>\n\n\n\n<li>You can use it with numbers, dates, and sometimes text.<\/li>\n\n\n\n<li>Equivalent to using <code>&gt;= value1 AND &lt;= value2<\/code> but cleaner and easier to read.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Practice Exercise<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Retrieve all students with marks between 50 and 80.<\/li>\n\n\n\n<li>List all orders placed between February 1, 2026, and February 28, 2026.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This structure works perfectly for website tutorials, LMS courses, or interactive lessons.<\/p>\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) > Filtering &#038; Conditions > BETWEEN<\/span><\/span><\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"menu_order":15,"template":"","class_list":["post-67","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>BETWEEN - SQL Learning Hub<\/title>\n<meta name=\"description\" content=\"&quot;Learn SQL BETWEEN operator to filter data by numbers, dates, or text. Easy examples, syntax, and practice exercises included.&quot;\" \/>\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\/between\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"BETWEEN - SQL Learning Hub\" \/>\n<meta property=\"og:description\" content=\"&quot;Learn SQL BETWEEN operator to filter data by numbers, dates, or text. Easy examples, syntax, and practice exercises included.&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/sql\/lesson\/between\/\" \/>\n<meta property=\"og:site_name\" content=\"SQL Learning Hub\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-16T18:49:10+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\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/between\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/between\\\/\",\"name\":\"BETWEEN - SQL Learning Hub\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/#website\"},\"datePublished\":\"2026-03-06T06:10:42+00:00\",\"dateModified\":\"2026-03-16T18:49:10+00:00\",\"description\":\"\\\"Learn SQL BETWEEN operator to filter data by numbers, dates, or text. Easy examples, syntax, and practice exercises included.\\\"\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/between\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/between\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/lesson\\\/between\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/sql\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Foundations Program (SQL-101) > Filtering & Conditions > BETWEEN\"}]},{\"@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":"BETWEEN - SQL Learning Hub","description":"\"Learn SQL BETWEEN operator to filter data by numbers, dates, or text. Easy examples, syntax, and practice exercises included.\"","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\/between\/","og_locale":"en_US","og_type":"article","og_title":"BETWEEN - SQL Learning Hub","og_description":"\"Learn SQL BETWEEN operator to filter data by numbers, dates, or text. Easy examples, syntax, and practice exercises included.\"","og_url":"https:\/\/gigz.pk\/sql\/lesson\/between\/","og_site_name":"SQL Learning Hub","article_modified_time":"2026-03-16T18:49:10+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/gigz.pk\/sql\/lesson\/between\/","url":"https:\/\/gigz.pk\/sql\/lesson\/between\/","name":"BETWEEN - SQL Learning Hub","isPartOf":{"@id":"https:\/\/gigz.pk\/sql\/#website"},"datePublished":"2026-03-06T06:10:42+00:00","dateModified":"2026-03-16T18:49:10+00:00","description":"\"Learn SQL BETWEEN operator to filter data by numbers, dates, or text. Easy examples, syntax, and practice exercises included.\"","breadcrumb":{"@id":"https:\/\/gigz.pk\/sql\/lesson\/between\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/sql\/lesson\/between\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/sql\/lesson\/between\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/sql\/"},{"@type":"ListItem","position":2,"name":"SQL Foundations Program (SQL-101) > Filtering & Conditions > BETWEEN"}]},{"@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\/67","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=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}