{"id":2450,"date":"2013-05-16T23:21:54","date_gmt":"2013-05-17T07:21:54","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=2450"},"modified":"2023-11-09T07:33:05","modified_gmt":"2023-11-09T14:33:05","slug":"mysql-min","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/","title":{"rendered":"MySQL MIN() Function"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn how to use the MySQL <code>MIN()<\/code> function to find the minimum value in a set of values.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL MIN() function<\/h2>\n\n\n\n<p>The <code>MIN()<\/code> function returns the minimum value in a set of values. The <code>MIN()<\/code> function is very useful in some scenarios such as finding the smallest number, selecting the least expensive product, or getting the lowest credit limit.<\/p>\n\n\n\n<p>Here&#8217;s the basic syntax of the <code>MIN()<\/code> function:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\">MIN(DISTINCT expression);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this syntax, the <code>MIN()<\/code> function accepts an expression that can be a column or a valid expression that involves columns.<\/p>\n\n\n\n<p>The <code>DISTINCT<\/code> does not have any effect on the <code>MIN()<\/code> function like other <a title=\"MySQL Aggregate Functions\" href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/\">aggregate functions<\/a> such as <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-sum\/\">SUM()<\/a><\/code>, <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-avg\/\">AVG()<\/a><\/code>and <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-count\/\">COUNT()<\/a><\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL MIN function examples<\/h2>\n\n\n\n<p>We&#8217;ll use the <code>products<\/code> table in the <a title=\"MySQL Sample Databae\" href=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/mysql-sample-database\/\">sample database<\/a> for the demonstration.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"144\" height=\"224\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/products.png\" alt=\"\" class=\"wp-image-8080\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/products.png 144w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/products-129x200.png 129w\" sizes=\"auto, (max-width: 144px) 100vw, 144px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">1) Using MySQL MIN() function to find the minimum value in a column<\/h3>\n\n\n\n<p>This query uses the <code>MIN()<\/code> function to get the lowest price of all products from the <code>products<\/code> table:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    <span class=\"hljs-keyword\">MIN<\/span>(buyPrice)\n<span class=\"hljs-keyword\">FROM<\/span>\n    products;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-min\/#1\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"111\" height=\"45\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-MIN-Function-Example.jpg\" alt=\"MySQL MIN Function Example\" class=\"wp-image-4122\"\/><\/figure>\n\n\n\n<p>In this example, the query checks all values in the column <code>buyPrice<\/code> of the <code>products<\/code> table and returns the lowest value.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2) Using MySQL MIN() with a WHERE clause example<\/h3>\n\n\n\n<p>This example uses the <code><a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/\">MIN()<\/a><\/code> function to find the lowest buy price of all motorcycles:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    <span class=\"hljs-keyword\">MIN<\/span>(buyPrice)\n<span class=\"hljs-keyword\">FROM<\/span>\n    products\n<span class=\"hljs-keyword\">WHERE<\/span>\n    productline = <span class=\"hljs-string\">'Motorcycles'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, specify a condition in the <code>WHERE<\/code> clause that gets only products whose product line is <code>Motorcycles<\/code>.<\/li>\n\n\n\n<li>Second, use the <code>MIN()<\/code> function to get the lowest value of the buy price of all motorcycles.<\/li>\n<\/ul>\n\n\n\n<p>Here is the output:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"106\" height=\"38\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-MIN-with-a-WHERE-clause.png\" alt=\"MySQL MIN with a WHERE clause\" class=\"wp-image-8081\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">3) Using MySQL MIN() with a subquery example<\/h3>\n\n\n\n<p>To find not only the price but also other product information such as product code and product name, you use the <code>MIN()<\/code> function in a <a title=\"MySQL subquery\" href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-subquery\/\">subquery <\/a>as shown in the following query:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    productCode, \n    productName, \n    buyPrice\n<span class=\"hljs-keyword\">FROM<\/span>\n    products\n<span class=\"hljs-keyword\">WHERE<\/span>\n    buyPrice = (\n        <span class=\"hljs-keyword\">SELECT<\/span> \n            <span class=\"hljs-keyword\">MIN<\/span>(buyPrice)\n        <span class=\"hljs-keyword\">FROM<\/span>\n            products);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-min\/#2\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"346\" height=\"44\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-MIN-with-Subquery.jpg\" alt=\"MySQL MIN with Subquery\" class=\"wp-image-4123\" title=\"MySQL MIN with Subquery\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-MIN-with-Subquery.jpg 346w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-MIN-with-Subquery-300x38.jpg 300w\" sizes=\"auto, (max-width: 346px) 100vw, 346px\" \/><\/figure>\n\n\n\n<p>How it works.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-subquery\/\">subquery<\/a> returns the lowest buy-price product in the <code>products<\/code> table.<\/li>\n\n\n\n<li>The outer query selects the product whose buy price is equal to the lowest price returned from the subquery.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4) Using MySQL MIN() function with a GROUP BY example<\/h3>\n\n\n\n<p>Like other aggregate functions, the <code>MIN()<\/code> function is often used with the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-group-by\/\"><code>GROUP BY<\/code><\/a> clause to find the minimum value for every group.<\/p>\n\n\n\n<p>This example uses the <code>MIN()<\/code> function with a <code>GROUP BY<\/code> clause to get the lowest buy price product for each product line:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    productline, \n    <span class=\"hljs-keyword\">MIN<\/span>(buyprice)\n<span class=\"hljs-keyword\">FROM<\/span>\n    products\n<span class=\"hljs-keyword\">GROUP<\/span> <span class=\"hljs-keyword\">BY<\/span> productline;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-min\/#3\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"211\" height=\"173\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-MIN-with-GROUP-BY-clause.jpg\" alt=\"MySQL MIN with GROUP BY clause\" class=\"wp-image-4124\" title=\"MySQL MIN with GROUP BY clause\"\/><\/figure>\n\n\n\n<p>In this example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, the <code>GROUP BY<\/code> clause groups products by product line.<\/li>\n\n\n\n<li>Second, the <code>MIN()<\/code> function returns the lowest buy-price product in each product line.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5) Using MySQL MIN() function with a HAVING clause example<\/h3>\n\n\n\n<p>This query uses the <code>MIN()<\/code> function with the <code>GROUP BY<\/code> and <code>HAVING<\/code> clauses to find the product lines that have the lowest buy price of less than 21:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    productLine, \n    <span class=\"hljs-keyword\">MIN<\/span>(buyPrice)\n<span class=\"hljs-keyword\">FROM<\/span>\n    products\n<span class=\"hljs-keyword\">GROUP<\/span> <span class=\"hljs-keyword\">BY<\/span> \n    productline\n<span class=\"hljs-keyword\">HAVING<\/span> \n    <span class=\"hljs-keyword\">MIN<\/span>(buyPrice) &lt; <span class=\"hljs-number\">25<\/span>\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> \n    <span class=\"hljs-keyword\">MIN<\/span>(buyPrice);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"202\" height=\"100\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-MIN-with-a-HAVING-clause-example.png\" alt=\"MySQL MIN with a HAVING clause example\" class=\"wp-image-8082\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-MIN-with-a-HAVING-clause-example.png 202w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/MySQL-MIN-with-a-HAVING-clause-example-200x99.png 200w\" sizes=\"auto, (max-width: 202px) 100vw, 202px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">6) Using MIN() with a correlated subquery<\/h3>\n\n\n\n<p>The following query selects the lowest-priced product in every product line by combining the <code>MIN()<\/code> function with a <a title=\"MySQL Correlated Subquery\" href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-subquery\/\">correlated subquery<\/a>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    productline, \n    productCode, \n    productName, \n    buyprice\n<span class=\"hljs-keyword\">FROM<\/span>\n    products a\n<span class=\"hljs-keyword\">WHERE<\/span>\n    buyprice = (\n        <span class=\"hljs-keyword\">SELECT<\/span> \n            <span class=\"hljs-keyword\">MIN<\/span>(buyprice)\n        <span class=\"hljs-keyword\">FROM<\/span>\n            products b\n        <span class=\"hljs-keyword\">WHERE<\/span>\n            b.productline = a.productline);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-min\/#4\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"470\" height=\"175\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-MIN-with-Correlated-Subquery.jpg\" alt=\"MySQL MIN with Correlated Subquery\" class=\"wp-image-4125\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-MIN-with-Correlated-Subquery.jpg 470w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/05\/MySQL-MIN-with-Correlated-Subquery-300x112.jpg 300w\" sizes=\"auto, (max-width: 470px) 100vw, 470px\" \/><\/figure>\n\n\n\n<p>In this example, for each product line from the outer query, the correlated subquery selects the lowest-priced product in the product line and returns the lowest price.<\/p>\n\n\n\n<p>The returned lowest price is then used as input for the outer query to find the related product data including product line, product code, product name, and buy price.<\/p>\n\n\n\n<p>If you want to achieve the same result without using the <code>MIN()<\/code> function and a <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-subquery\/\">subquery<\/a>, you can use a <a title=\"MySQL Self Join\" href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-self-join\/\">self join<\/a> as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    a.productline, \n    a.productCode, \n    a.productName, \n    a.buyprice\n<span class=\"hljs-keyword\">FROM<\/span>\n    products a\n<span class=\"hljs-keyword\">LEFT<\/span> <span class=\"hljs-keyword\">JOIN<\/span> products b \n    <span class=\"hljs-keyword\">ON<\/span> a.productline = b.productline\n        <span class=\"hljs-keyword\">AND<\/span> b.buyprice &lt; a.buyprice\n<span class=\"hljs-keyword\">WHERE<\/span>\n    b.productcode <span class=\"hljs-keyword\">IS<\/span> <span class=\"hljs-literal\">NULL<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-min\/#5\" target=\"_blank\" rel=\"noopener noreferrer\">Try It Out<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the <code>MIN()<\/code> function to find the minimum value in a set of values.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"2450\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/\"\n\t\t\t\tdata-post-title=\"MySQL MIN() Function\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"2450\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/\"\n\t\t\t\tdata-post-title=\"MySQL MIN() Function\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows you how to use the MySQL MIN() function to find the minimum value in a set of values.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":509,"menu_order":5,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-2450","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL MIN() Function<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use the MySQL MIN() function to find the minimum value in a set of values with many practical examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL MIN() Function\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use the MySQL MIN() function to find the minimum value in a set of values with many practical examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-09T14:33:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/products.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/mysql-min\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/mysql-min\\\/\",\"name\":\"MySQL MIN() Function\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/mysql-min\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/mysql-min\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/products.png\",\"datePublished\":\"2013-05-17T07:21:54+00:00\",\"dateModified\":\"2023-11-09T14:33:05+00:00\",\"description\":\"This tutorial shows you how to use the MySQL MIN() function to find the minimum value in a set of values with many practical examples.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/mysql-min\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/mysql-min\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/mysql-min\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/products.png\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/products.png\",\"width\":144,\"height\":224},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/mysql-min\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Aggregate Functions\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-aggregate-functions\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL MIN() Function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?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":"MySQL MIN() Function","description":"This tutorial shows you how to use the MySQL MIN() function to find the minimum value in a set of values with many practical examples.","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:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/","og_locale":"en_US","og_type":"article","og_title":"MySQL MIN() Function","og_description":"This tutorial shows you how to use the MySQL MIN() function to find the minimum value in a set of values with many practical examples.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-11-09T14:33:05+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/products.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/","url":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/","name":"MySQL MIN() Function","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/products.png","datePublished":"2013-05-17T07:21:54+00:00","dateModified":"2023-11-09T14:33:05+00:00","description":"This tutorial shows you how to use the MySQL MIN() function to find the minimum value in a set of values with many practical examples.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/products.png","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2019\/08\/products.png","width":144,"height":224},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Aggregate Functions","item":"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/"},{"@type":"ListItem","position":3,"name":"MySQL MIN() Function"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=2450"}],"version-history":[{"count":3,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2450\/revisions"}],"predecessor-version":[{"id":12232,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/2450\/revisions\/12232"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/509"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=2450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}