TINYINT is the smallest standard integer data type available in several SQL dialects. It occupies exactly 1 byte (8 bits) of storage and is ideal for columns that will never exceed a few hundred distinct values. The signed range is -128 to 127, while the unsigned range is 0 to 255. Behavior differs slightly by database:- MySQL and MariaDB support both signed (default) and UNSIGNED variants, optional ZEROFILL, and formerly allowed a display width (now deprecated).- SQL Server supports only an unsigned range (0 to 255) and treats TINYINT as always positive.- SQLite applies dynamic typing; declaring a column TINYINT gives it INTEGER affinity, still stored efficiently as 1 byte when values fit.- PostgreSQL and Oracle do not have a native TINYINT; use SMALLINT or NUMBER(3) instead, or create a domain.Casting or arithmetic operations will silently promote TINYINT to a larger integer type when needed. Overflow on insert or update raises an error in strict SQL modes but may clip or wrap in lenient modes. Always verify range before assignment.
UNSIGNED
(keyword) - Makes the range 0 to 255 instead of -128 to 127 (MySQL/MariaDB).ZEROFILL
(keyword) - Left-pads the stored value with zeros when selected (MySQL/MariaDB; implies UNSIGNED).Display width
(integer) - Deprecated MySQL syntax TINYINT(m) that specified display width; ignored in 8.0+.Microsoft SQL Server 6.0 (1995)
No. SQL Server enforces an unsigned 0-255 range, while MySQL defaults to signed but lets you add the UNSIGNED attribute.
BOOLEAN is a synonym for TINYINT(1) in MySQL. The (1) is deprecated display width metadata and does not constrain the value to 0 or 1.
Yes, unless you declare the column NOT NULL. NULL consumes no space in fixed-length rows and signals unknown or missing data.
Use SMALLINT and optionally add a CHECK constraint: `age SMALLINT CHECK (age BETWEEN 0 AND 255)`.