D
D
Dmitry Krapivin2018-07-24 11:08:29
Database design
Dmitry Krapivin, 2018-07-24 11:08:29

How are negative temperature values ​​stored in the database?

Temperature -35
Temperature +30
How is such numerical data stored in the database? The number is a separate field of type number, and the operator is in another field of type text? Or is it done differently?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2018-07-24
@kiru

To store such data, the INT field type is suitable.
In your case, when using MySQL, for example, you can use TINYINT:

  • TINYINT[(M)] [UNSIGNED] [ZEROFILL]
    A very small integer. Signed range -128 to 127. Unsigned range 0 to 255.

R
Rsa97, 2018-07-24
@Rsa97

Store in Kelvin, there will be no negative values ​​:-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question