MIDDLEINT (often written MEDIUMINT) is a non-standard, MySQL-specific numeric type that sits between SMALLINT and INT in storage size. It occupies 3 bytes per value and is ideal when SMALLINT’s range is too small but INT’s 4-byte footprint is wasteful. Signed MIDDLEINT supports values from ‑8,388,608 to 8,388,607, while UNSIGNED extends the positive range to 16,777,215. Optional ZEROFILL pads displayed values with leading zeros.Although accepted by MySQL, MIDDLEINT is simply a synonym for MEDIUMINT; other database engines do not recognize it. Mixing it with cross-database code can therefore cause portability issues. Display width (deprecated since MySQL 8.0.17) never affects storage, only the default formatting in certain clients. Always choose MIDDLEINT only when your numeric domain safely fits inside its bounds.
display_width
(Integer) - (Deprecated) Number of digits MySQL should displayUNSIGNED
(Keyword) - Stores only non-negative numbers, doubling upper rangeZEROFILL
(Keyword) - Left-pads displayed numbers with zeros to the display_widthMEDIUMINT, SMALLINT, INT, BIGINT, UNSIGNED, ZEROFILL
MySQL 3.23 (as MEDIUMINT; MIDDLEINT accepted as alias)
They are identical in MySQL; MIDDLEINT is simply an accepted alias for MEDIUMINT.
No. PostgreSQL does not recognize MIDDLEINT or MEDIUMINT. Use SMALLINT or INTEGER instead.
Exactly 3 bytes per row, regardless of display_width, UNSIGNED, or ZEROFILL options.
Yes. In strict mode, inserting a value outside the valid range raises an error instead of truncating the value.