Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What's the difference between mysql int and tinyint?
What's the difference between mysql int and tinyint?
The difference between Mysql int and tinyint lies mainly in the size of stored values and the storage space used for storage.

1、int

Integer data (all numbers) from -2 3 1(-2 147 483 648) to 231–1(2147 483 647). The storage size is 4 bytes. The SQL-92 synonym for int is integer.

2、tinyint

Integer data from 0 to 255. The storage size is 1 byte.

Extension: Other integer types in mysql: bigint and smallint.

bigint

Integer data (all numbers) from-263 (-922372036854775808) to 263-1(922372036854775807). The storage size is 8 bytes.

P.S. bigint already has a length, and the length in mysql table is only the number of digits used for display.

smallint

Integer data from-215 (-32,768) to 215–1(32,767). The storage size is 2 bytes.