{"id":4704,"date":"2013-12-17T21:04:50","date_gmt":"2013-12-18T05:04:50","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=4704"},"modified":"2023-10-12T22:00:47","modified_gmt":"2023-10-13T05:00:47","slug":"mysql-format-function","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-string-functions\/mysql-format-function\/","title":{"rendered":"MySQL FORMAT() Function"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: This tutorial shows you how to use the MySQL <code>FORMAT()<\/code> function to format decimal numbers in various locales.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to the MySQL FORMAT() function<\/h2>\n\n\n\n<p>Sometimes, you use an expression or an <a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/\">aggregate function<\/a> such as <a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-avg\/\">AVG<\/a> to calculate values in the databases such as inventory turnover, the average net price of products, and the average invoice value.<\/p>\n\n\n\n<p>The result of the expression is a <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-decimal\/\">decimal<\/a> with many decimal places. To format those numbers, you use the <code>FORMAT<\/code> function with the following syntax:<\/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\">FORMAT(N,D,locale);<\/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>The <code>FORMAT<\/code> function formats the number N to format like &#8216;#,###,###.##&#8217;, rounds to D decimal places. It returns a value as a string.<\/p>\n\n\n\n<p>The <code>FORMAT<\/code> function accepts three arguments:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code>N<\/code> is the number that you want to format.<\/li>\n\n\n\n<li>The <code>D<\/code> is the number of decimal places that you want to round.<\/li>\n\n\n\n<li>The locale is an optional argument that determines a thousand separators and grouping between separators. If you omit the locale operator, MySQL will use <code>en_US<\/code> by default. The following link provides <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/locale-support.html\">all locale names supported by MySQL<\/a>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL FORMAT function examples<\/h2>\n\n\n\n<p>See the following examples of using the <code>FORMAT<\/code> function.<\/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> <span class=\"hljs-keyword\">FORMAT<\/span>(<span class=\"hljs-number\">12500.2015<\/span>, <span class=\"hljs-number\">2<\/span>);<\/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-format\/#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=\"163\" height=\"56\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-example.jpg\" alt=\"MySQL FORMAT example\" class=\"wp-image-4732\" title=\"MySQL FORMAT example\"\/><\/figure>\n\n\n\n<p>The following statement uses the <code>FORMAT<\/code> function with the second argument zero, therefore, the result does not have any decimal places.<\/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> <span class=\"hljs-keyword\">FORMAT<\/span>(<span class=\"hljs-number\">12500.2015<\/span>, <span class=\"hljs-number\">0<\/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><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-format\/#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=\"162\" height=\"55\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-zero-decimal-places.jpg\" alt=\"MySQL FORMAT zero decimal places\" class=\"wp-image-4736\" title=\"MySQL FORMAT zero decimal places\"\/><\/figure>\n\n\n\n<p>The following statement uses the <code>de_DE<\/code> locale instead of the <code>en_US<\/code> locale:<\/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> <span class=\"hljs-keyword\">FORMAT<\/span>(<span class=\"hljs-number\">12500.2015<\/span>, <span class=\"hljs-number\">2<\/span>,<span class=\"hljs-string\">'de_DE'<\/span>);<\/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-format\/#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=\"212\" height=\"57\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-de_DE-locale.jpg\" alt=\"MySQL FORMAT de_DE locale\" class=\"wp-image-4730\" title=\"MySQL FORMAT de_DE locale\"\/><\/figure>\n\n\n\n<p>As you see in the result, the <code>de_DE<\/code> locale use dot (.) for grouping thousand and comma (,) for decimal mark.<\/p>\n\n\n\n<p>Let&#8217;s take a look at the <code>products<\/code> table in the <a href=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/mysql-sample-database\/\">sample database<\/a>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2023\/10\/products.svg\" alt=\"\" class=\"wp-image-10788\"\/><\/figure>\n\n\n\n<p>To calculate the stock value of each product, you multiply the quantity in stock and buy price as follows:<\/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    productname, quantityInStock * buyPrice stock_value\n<span class=\"hljs-keyword\">FROM<\/span>\n    products;<\/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-format\/#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=\"357\" height=\"223\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-decimal-places.jpg\" alt=\"MySQL FORMAT decimal places\" class=\"wp-image-4731\" title=\"MySQL FORMAT decimal places\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-decimal-places.jpg 357w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-decimal-places-300x187.jpg 300w\" sizes=\"auto, (max-width: 357px) 100vw, 357px\" \/><\/figure>\n\n\n\n<p>The result does not look good because there are many decimal places.<\/p>\n\n\n\n<p>To make it better, you can combine two functions:&nbsp; <code>FORMAT<\/code> and&nbsp;<code>CONCAT<\/code>. The <code>FORMAT<\/code> function formats the stock value rounded to 2 decimal places. The <a href=\"https:\/\/www.mysqltutorial.org\/mysql-string-functions\/mysql-concat\/\">CONCAT function <\/a>adds the USD symbol ($) at the beginning of the stock value string:<\/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    productname,\n    <span class=\"hljs-keyword\">CONCAT<\/span>(<span class=\"hljs-string\">'$'<\/span>,\n            <span class=\"hljs-keyword\">FORMAT<\/span>(quantityInStock * buyPrice, <span class=\"hljs-number\">2<\/span>)) stock_value\n<span class=\"hljs-keyword\">FROM<\/span>\n    products;<\/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<p><a class=\"sql\" href=\"https:\/\/www.mysqltutorial.org\/tryit\/query\/mysql-format\/#5\" 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=\"313\" height=\"223\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-USD-sign.jpg\" alt=\"MySQL FORMAT USD sign\" class=\"wp-image-4733\" title=\"MySQL FORMAT USD sign\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-USD-sign.jpg 313w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-USD-sign-300x214.jpg 300w\" sizes=\"auto, (max-width: 313px) 100vw, 313px\" \/><\/figure>\n\n\n\n<p>Notice that the <code>FORMAT<\/code> function returns a string value. It means that if you want to sort the results of the <code>FORMAT<\/code> function using the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-order-by\/\">ORDER BY clause<\/a>, MySQL will sort the results using string-based not numeric-based.<\/p>\n\n\n\n<p>For example, the following statement sorts the stock values alphabetically.<\/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    productname,\n    <span class=\"hljs-keyword\">CONCAT<\/span>(<span class=\"hljs-string\">'$'<\/span>,\n            <span class=\"hljs-keyword\">FORMAT<\/span>(quantityInStock * buyPrice, <span class=\"hljs-number\">2<\/span>)) stock_value\n<span class=\"hljs-keyword\">FROM<\/span>\n    products\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> stock_value;<\/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-format\/#6\" 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=\"301\" height=\"223\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-with-ORDER-BY.jpg\" alt=\"MySQL FORMAT with ORDER BY\" class=\"wp-image-4735\" title=\"MySQL FORMAT with ORDER BY\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-with-ORDER-BY.jpg 301w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-with-ORDER-BY-300x222.jpg 300w\" sizes=\"auto, (max-width: 301px) 100vw, 301px\" \/><\/figure>\n\n\n\n<p>To sort the stock values numerically, you put the expression in the <code>ORDER BY<\/code> clause 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    productname,\n    <span class=\"hljs-keyword\">CONCAT<\/span>(<span class=\"hljs-string\">'$'<\/span>,\n            <span class=\"hljs-keyword\">FORMAT<\/span>(quantityInStock * buyPrice, <span class=\"hljs-number\">2<\/span>)) stock_value\n<span class=\"hljs-keyword\">FROM<\/span>\n    products\n<span class=\"hljs-keyword\">ORDER<\/span> <span class=\"hljs-keyword\">BY<\/span> quantityInStock * buyPrice;<\/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-format\/#7\" 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=\"326\" height=\"223\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-with-correct-ORDER-BY.jpg\" alt=\"MySQL FORMAT with correct ORDER BY\" class=\"wp-image-4734\" title=\"MySQL FORMAT with correct ORDER BY\" srcset=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-with-correct-ORDER-BY.jpg 326w, https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-with-correct-ORDER-BY-300x205.jpg 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use the MySQL <code>FORMAT()<\/code> function to format a number in various locale names.<\/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=\"4704\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-string-functions\/mysql-format-function\/\"\n\t\t\t\tdata-post-title=\"MySQL FORMAT() 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=\"4704\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-string-functions\/mysql-format-function\/\"\n\t\t\t\tdata-post-title=\"MySQL FORMAT() 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 FORMAT function to format decimal numbers in various locales.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":7027,"menu_order":23,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-4704","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 FORMAT() Function<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use the MySQL FORMAT() function to format decimal numbers in various locales.\" \/>\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-format-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL FORMAT() Function\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use the MySQL FORMAT() function to format decimal numbers in various locales.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-format-function\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-13T05:00:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-example.jpg\" \/>\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-format-function\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-format-function\\\/\",\"name\":\"MySQL FORMAT() Function\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-format-function\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-format-function\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/12\\\/MySQL-FORMAT-example.jpg\",\"datePublished\":\"2013-12-18T05:04:50+00:00\",\"dateModified\":\"2023-10-13T05:00:47+00:00\",\"description\":\"This tutorial shows you how to use the MySQL FORMAT() function to format decimal numbers in various locales.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-format-function\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-format-function\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-format-function\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/12\\\/MySQL-FORMAT-example.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2013\\\/12\\\/MySQL-FORMAT-example.jpg\",\"width\":163,\"height\":56},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-format-function\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL String Functions\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-string-functions\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL FORMAT() 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 FORMAT() Function","description":"This tutorial shows you how to use the MySQL FORMAT() function to format decimal numbers in various locales.","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-format-function\/","og_locale":"en_US","og_type":"article","og_title":"MySQL FORMAT() Function","og_description":"This tutorial shows you how to use the MySQL FORMAT() function to format decimal numbers in various locales.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-format-function\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-10-13T05:00:47+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-example.jpg","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-format-function\/","url":"https:\/\/www.mysqltutorial.org\/mysql-format-function\/","name":"MySQL FORMAT() Function","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-format-function\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-format-function\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-example.jpg","datePublished":"2013-12-18T05:04:50+00:00","dateModified":"2023-10-13T05:00:47+00:00","description":"This tutorial shows you how to use the MySQL FORMAT() function to format decimal numbers in various locales.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-format-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-format-function\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-format-function\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-example.jpg","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2013\/12\/MySQL-FORMAT-example.jpg","width":163,"height":56},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-format-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL String Functions","item":"https:\/\/www.mysqltutorial.org\/mysql-string-functions\/"},{"@type":"ListItem","position":3,"name":"MySQL FORMAT() 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\/4704","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=4704"}],"version-history":[{"count":3,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/4704\/revisions"}],"predecessor-version":[{"id":11085,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/4704\/revisions\/11085"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/7027"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=4704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}