{"id":4021,"date":"2014-11-03T00:52:38","date_gmt":"2014-11-03T08:52:38","guid":{"rendered":"http:\/\/www.mysqltutorial.org\/?page_id=4021"},"modified":"2023-12-27T18:37:09","modified_gmt":"2023-12-28T01:37:09","slug":"mysql-decimal","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-decimal\/","title":{"rendered":"MySQL DECIMAL Data Type"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you will learn about MySQL <code>DECIMAL<\/code> data type and how to use it to store exact numeric values in the databases.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL DECIMAL data type<\/h2>\n\n\n\n<p>The MySQL <code>DECIMAL<\/code> data type allows you to store exact numeric values in the database. In practice, you often use the <code>DECIMAL<\/code> data type for columns that\u00a0preserve exact precision e.g., monetary data in financial systems.<\/p>\n\n\n\n<p>To define a column whose data type is <code>DECIMA<\/code>L, you use 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\">column_name DECIMAL(P,D);<\/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:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>P<\/code> is the precision that represents the number of significant digits. The range of <code>P<\/code> is 1 to 65.<\/li>\n\n\n\n<li><code>D<\/code> is the scale that represents the number of digits after the decimal point. The range of <code>D<\/code> is 0 and 30. MySQL requires that <code>D<\/code> is less than or equal to (&lt;=) <code>P<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>The <code>DECIMAL(P,D)<\/code> means that the column can store up to <code>P<\/code> digits with <code>D<\/code>\u00a0decimals. The actual range of the decimal column depends on the precision and scale.<\/p>\n\n\n\n<p>Besides the <code>DECIMAL<\/code> keyword, you can also use <code>DEC<\/code>, <code>FIXED<\/code>, or <code>NUMERIC<\/code> because they are synonyms for <code>DECIMAL<\/code>.<\/p>\n\n\n\n<p>The following example defines the <code>amount<\/code> column with <code>DECIMAL<\/code> data type.<\/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\">amount DECIMAL(6,2);<\/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>In this example, the amount column can store 6 digits with 2 decimal places; therefore, the range of the amount column is from 9999.99 to -9999.99.<\/p>\n\n\n\n<p>MySQL allows you to use the following syntax:<\/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\">column_name DECIMAL(P);<\/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>This is equivalent to:<\/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\">column_name DECIMAL(P,0);<\/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>In this case, the column contains no fractional part or decimal point.<\/p>\n\n\n\n<p>In addition, you can even use the following syntax:<\/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\">column_name DECIMAL;<\/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>The default value of P is 10 and D is 0, which is equivalent to the following:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">column_name DECIMAL(10,0);<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\">MySQL DECIMAL storage<\/h2>\n\n\n\n<p>MySQL assigns the storage for integer and fractional parts separately. MySQL uses a binary format to store the <code>DECIMAL<\/code> values. It packs 9 digits into 4 bytes.<\/p>\n\n\n\n<p>For each part, it takes 4 bytes to store each multiple of 9 digits. The storage required for leftover digits is illustrated in the following table:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><strong>Leftover Digits<\/strong><\/th><th><strong>Bytes<\/strong><\/th><\/tr><\/thead><tbody><tr><td>0<\/td><td>0<\/td><\/tr><tr><td>1\u20132<\/td><td>1<\/td><\/tr><tr><td>3\u20134<\/td><td>2<\/td><\/tr><tr><td>5\u20136<\/td><td>3<\/td><\/tr><tr><td>7\u20139<\/td><td>4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>For example, <code>DECIMAL(19,9)<\/code> has 9 digits for the fractional part and 19-9 = 10 digits for the integer part. The fractional part requires 4 bytes. The integer part requires 4 bytes for the first 9 digits, for 1 leftover digit, it requires 1 more byte. In total, the <code>DECIMAL(19,9)<\/code> column requires 9 bytes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL DECIMAL data type and monetary data<\/h2>\n\n\n\n<p>We often\u00a0use the <code>DECIMAL<\/code> data type for monetary data such as prices, salary, account balances, and so on. If you design a database that handles the monetary data, the following syntax should be fine.<\/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\">amount DECIMAL(19,2);<\/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>However, if you want to comply with <a href=\"https:\/\/en.wikipedia.org\/wiki\/Generally_Accepted_Accounting_Principles_(United_States)\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Generally Accepted Accounting Principles (GAAP)<\/a> rules, the monetary column must have at least 4 decimal places to make sure that the rounding value does not exceed $0.01. In this case, you should define the column with 4 decimal places as follows:<\/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\">amount DECIMAL(19,4);<\/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<h2 class=\"wp-block-heading\">&nbsp;MySQL DECIMAL data type example<\/h2>\n\n\n\n<p>First, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-table\/\">create a new table<\/a> named <code>materials<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">CREATE TABLE materials (\n    id INT AUTO_INCREMENT PRIMARY KEY,\n    description VARCHAR(<span class=\"hljs-number\">255<\/span>) NOT <span class=\"hljs-keyword\">NULL<\/span>,\n    cost DECIMAL(<span class=\"hljs-number\">19<\/span>,<span class=\"hljs-number\">4<\/span>) NOT <span class=\"hljs-keyword\">NULL<\/span>\n);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>materials<\/code> table has three columns:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>id<\/code> is the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-auto_increment\/\">auto-increment<\/a> <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-primary-key\/\">primary key<\/a> column with the <code>INT<\/code> data type.<\/li>\n\n\n\n<li><code>description<\/code> represents the material&#8217;s description with the <code>VARCHAR<\/code> data type.<\/li>\n\n\n\n<li><code>cost<\/code> represents the cost of the material, which has the <code>DECIMAL(19,4)<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>The <code>cost <\/code>column can store up to 19 digits with 4 decimal places.<\/p>\n\n\n\n<p>Second, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert\/\">insert data<\/a> into the <code>materials<\/code> table.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> materials(description, <span class=\"hljs-keyword\">cost<\/span>) \n<span class=\"hljs-keyword\">VALUES<\/span> \n  (<span class=\"hljs-string\">'Bicycle'<\/span>, <span class=\"hljs-number\">500.34<\/span>), \n  (<span class=\"hljs-string\">'Seat'<\/span>, <span class=\"hljs-number\">10.23<\/span>), \n  (<span class=\"hljs-string\">'Break'<\/span>, <span class=\"hljs-number\">5.21<\/span>);<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><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>Third, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-select-from\/\">query data<\/a> from the <code>materials<\/code> table.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" 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    *\n<span class=\"hljs-keyword\">FROM<\/span>\n    materials;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><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>Output:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">+----+-------------+----------+\n| id | description | cost     |\n+----+-------------+----------+\n|  <span class=\"hljs-number\">1<\/span> | Bicycle     | <span class=\"hljs-number\">500.3400<\/span> |\n|  <span class=\"hljs-number\">2<\/span> | Seat        |  <span class=\"hljs-number\">10.2300<\/span> |\n|  <span class=\"hljs-number\">3<\/span> | Break       |   <span class=\"hljs-number\">5.2100<\/span> |\n+----+-------------+----------+\n<span class=\"hljs-number\">3<\/span> rows <span class=\"hljs-keyword\">in<\/span> <span class=\"hljs-keyword\">set<\/span> (0.00 sec)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h1 class=\"wp-block-heading\">Summary<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use MySQL <code>DECIMAL<\/code> data type to store exact numeric values such as financial data in the database.<\/li>\n\n\n\n<li>Use <code>column_name DECIMAL (P, D)<\/code> to define a column with the <code>DECIMAL<\/code> data type that has up to <code>P<\/code> digits and <code>D<\/code> decimal places.<\/li>\n\n\n\n<li>The <code>DECIMAL(P)<\/code> is equivalent to <code>DECIMAL(P,0)<\/code> and <code>DECIMAL<\/code> is equivalent to <code>DECIMAL(P, 0)<\/code>.<\/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=\"4021\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-decimal\/\"\n\t\t\t\tdata-post-title=\"MySQL DECIMAL Data Type\"\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=\"4021\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-decimal\/\"\n\t\t\t\tdata-post-title=\"MySQL DECIMAL Data Type\"\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>In this tutorial, you will learn about MySQL DECIMAL data type and how to use it to store exact numeric values in the databases.<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":174,"menu_order":70,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-4021","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 DECIMAL Data Type<\/title>\n<meta name=\"description\" content=\"This tutorial shows you how to use MySQL DECIMAL data type to store exact values such as financial data in the databases.\" \/>\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-decimal\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL DECIMAL Data Type\" \/>\n<meta property=\"og:description\" content=\"This tutorial shows you how to use MySQL DECIMAL data type to store exact values such as financial data in the databases.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-decimal\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-28T01:37:09+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-decimal\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-decimal\\\/\",\"name\":\"MySQL DECIMAL Data Type\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"datePublished\":\"2014-11-03T08:52:38+00:00\",\"dateModified\":\"2023-12-28T01:37:09+00:00\",\"description\":\"This tutorial shows you how to use MySQL DECIMAL data type to store exact values such as financial data in the databases.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-decimal\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-decimal\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-decimal\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Basics\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-basics\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"MySQL DECIMAL Data Type\"}]},{\"@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 DECIMAL Data Type","description":"This tutorial shows you how to use MySQL DECIMAL data type to store exact values such as financial data in the databases.","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-decimal\/","og_locale":"en_US","og_type":"article","og_title":"MySQL DECIMAL Data Type","og_description":"This tutorial shows you how to use MySQL DECIMAL data type to store exact values such as financial data in the databases.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-decimal\/","og_site_name":"MySQL Tutorial","article_modified_time":"2023-12-28T01:37:09+00:00","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-decimal\/","url":"https:\/\/www.mysqltutorial.org\/mysql-decimal\/","name":"MySQL DECIMAL Data Type","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"datePublished":"2014-11-03T08:52:38+00:00","dateModified":"2023-12-28T01:37:09+00:00","description":"This tutorial shows you how to use MySQL DECIMAL data type to store exact values such as financial data in the databases.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-decimal\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-decimal\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-decimal\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Basics","item":"https:\/\/www.mysqltutorial.org\/mysql-basics\/"},{"@type":"ListItem","position":3,"name":"MySQL DECIMAL Data Type"}]},{"@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\/4021","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=4021"}],"version-history":[{"count":4,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/4021\/revisions"}],"predecessor-version":[{"id":13594,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/4021\/revisions\/13594"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/174"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=4021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}