number of waves in numerical values
Whereas there will be no negative number, the field may be of the type int unsigned
which will store from 0 to 4294967295.
If it is an immense db and is considering space reduction, you can use other integer numeric types:
CREATE TABLE `inttypes` ( -- SIGNED ( -X ~ X ) UNSIGNED ( 0 ~ X )
`tinyint` TINYINT(4) DEFAULT NULL, -- 127 255
`smallint` SMALLINT(6) DEFAULT NULL, -- 32767 65535
`mediumint` MEDIUMINT(9) DEFAULT NULL, -- 8388607 16777215
`int` INT(11) DEFAULT NULL, -- 2147483647 4294967295
`bigint` BIGINT(20) DEFAULT NULL -- 9223372036854775807 18446744073709551615
);
Source:
Mysql 8.0 Reference Manual - 11.2.1 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT
It depends on the size of the numbers you want to store. The medium is
INT
. accepting a maximum of 2147483648 and a minimum of -2147483648.– bfavaretto
Show ball bfavaretto. So would not have problems in calculating 02 fields that store numerical values right? For example (02 variables in PHP with values from BD).:
$campo1 - $campo2
.– user24136
No. But with the data you have in the other question, you can’t safely say that it’s a typing problem. PHP should convert correctly at the time of subtraction. There is something strange in your application set that we don’t know what it is.
– bfavaretto