Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8584161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:42:28+00:00 2026-06-11T21:42:28+00:00

I have a table in MySQL with a field that is decimal, length 9,

  • 0

I have a table in MySQL with a field that is decimal, length 9, unsigned. I’m using it for prices.

After I insert the data, and query for it, it has all been rounded and the decimal has been removed.

I’m confused as to why.

Troubleshooting tips?


Host: web.com

phpMyAdmin version: 2.11.10.1

MySQL client version: 5.0.95

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:42:29+00:00Added an answer on June 11, 2026 at 9:42 pm

    Decimal type in MySQL has two tuning knobs: precision and scale. You omitted the scale, so it defaults to 0.

    Documentation (link)

    The declaration syntax for a DECIMAL column is DECIMAL(M,D). The ranges of values for the arguments in MySQL 5.1 are as follows:

    M is the maximum number of digits (the precision). It has a range of 1 to 65. (Older versions of MySQL permitted a range of 1 to 254.)

    D is the number of digits to the right of the decimal point (the scale). It has a range of 0 to 30 and must be no larger than M.

    Example

    mysql> create table test01 (field01 decimal(9));
    Query OK, 0 rows affected (0.01 sec)
    
    mysql> insert into test01 (field01) values (123.456);
    Query OK, 1 row affected, 1 warning (0.00 sec)
    
    mysql> select * from test01;
    +---------+
    | field01 |
    +---------+
    |     123 |
    +---------+
    1 row in set (0.00 sec)
    
    mysql> create table test02 (field01 decimal(9, 4));
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> insert into test02 (field01) values (123.456);
    Query OK, 1 row affected (0.01 sec)
    
    mysql> select * from test02;
    +----------+
    | field01  |
    +----------+
    | 123.4560 |
    +----------+
    1 row in set (0.00 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL table that has a field of comma separated values. How
I currently have a MySQL database with a table that has a field that
I have a MySQL table with a primary key field that has AUTO_INCREMENT on.
Given a table in MySQL with rows that have a 'Country' field, I need
I have a mysql table field set as time type which stores data in
I have a table in MySQL 4.0 which currently has a year field as
I have a MySQL table which has a product_id field (big integer) 1102330008 1102330025
I have a database table in mysql with a field that is of TIMESTAMP
I have a table in MySQL that has a primary key: mysql> desc gifts;
I have a very large table in MySQL. I'm using a CHAR(32) field which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.