Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm realising that this is the first time I've stored temperatures in a MySQL DB.

What do think the best mysql field type for temperatures (c) is?

Decimial (3,3) ?

share|improve this question
This depends on application domain. If you're working with weather and temperatures (like, then you're looking at a level of precision that is my less granular than if you're researching chemical reactions at varying pressures. – swasheck Jun 21 '12 at 19:42
up vote 1 down vote accepted

This would depend on the the scale of the temperature

Since the lowest known written temperature of usable numbers on earth is -459.67, I would go with DECIMAL(5,2). This would easily accommodate absolute zero (0K = -273.15 C).

If you are recording temperatures for astronomical bodies (Sun's Surface is about 6,000 C - 11,000 C, Inner Core is 15,000,000 C), you will need a bigger scale like DECIMAL(10,2).

share|improve this answer

You should use DECIMAL (3,1) for temperature in (Celsius)

share|improve this answer

It of course would depend on what type of temps you are recording and what temperature type you are using and what level of detail you need, but Decimal (4, 1) would be what you would want for most outside temperatures if you are using a Farenheit scale. Celsius outside temps are probaly OK with Decimal (3, 1). If you are doing scientific work, you might want more places possibly both in front of and behind the decimal.

share|improve this answer

It depends on the temperature range and precision you want to store. DECIMAL(3,3) means that your range will be -0.999 .. 0.999 - this is probably not what you want. If you want to store meteorological data, you will stay in the range of -99.9 .. 99.9 and therefore you will need DECIMAL(3,1) as @Mahesh suggested before. If you have more precise measurements, that you want to allow more digits (raise the first number of the decimal) and more decimal places (raise the second number).

And see the docs.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.