There are 5 different integer columns, each hold integer values of different sizes.
Moreover, each can be signed or unsigned. If your value can’t ever be negative (for example, for an index), then you should probably make your values unsigned.
DROP TABLE `foo`.`example_03`;
CREATE TABLE IF NOT EXISTS `foo`.`example_03` (
f_01 TINYINT, -- from -128 to 127
f_02 TINYINT UNSIGNED, -- from 0 to 256
f_03 SMALLINT, -- from -32,768 to 32,767
f_04 SMALLINT UNSIGNED, -- from 0 to 65,535
f_05 MEDIUMINT, -- from -8,388,608 to 8,388,607
f_06 MEDIUMINT UNSIGNED, -- from 0 to 16,777,215
f_07 INT, -- from -2,147,483,648 to 2,147,483,647
f_08 INT UNSIGNED, -- from 0 to 4,294,967,295
f_09 BIGINT,
-- from -9,223,372,036,854,775,808
-- to 9,223,372,036,854,775,807
f_10 BIGINT UNSIGNED -- from 0 to 18,446,744,073,709,551,615
);



















Be The First To Comment
Related Post
Please Leave Your Comments Below