SmallInt is an accurate numeric data type whose accuracy is unchanged after arithmetic operations, with 2-byte encoding
The range of signed smallint values is -2^15-------2^15-1, which is -32768----32767
The range of unsigned smallint values is 0-------2^16-1, 0----65535,
The int data type is stored as a 4-byte integer, with a range of values -2^31---2^31, so the smallint type is preferred when considering the maximum data range.
Numeric constants that support ranges in the INT data type are still interpreted as numeric, the number of decimal digits is 0, and the precision is sufficient to hold the value specified.
BigInt can accurately represent integers from the -2^63------2^63-1, the data type is stored as 8 bytes of storage, and when the bigint value is within the range supported by the INT data type, SQL Server will
BigInt is implicitly converted to int, and if the bigint expression contains a value outside the range supported by the INT data type, a conversion error occurs at run time.
In the data type precedence table, the bigint data type is above int, smallint
tinyint if the field is set to unsigned, only integers from 0 to 255 can be stored and cannot be used to store negative numbers
If the field is not set to unsigned, a number between 128 and 127 will be stored
tinyint storage with 1 bytes
In general, in order to save space, the smallest integer data should be used as much as possible, these types of integers look small, but in larger tables, the number of bytes increases quickly.
On the other hand, once you have created a field, it is difficult to modify it. So, for security reasons, you should predict how much a field needs to be stored, and then choose the appropriate data type.