BINARY
Fixed-length binary string type. This type stores a fixed number of bytes, padding with zero bytes if the data is shorter.
Syntax
BINARY(M)Description
Examples
CREATE TABLE bins (a BINARY(10));
INSERT INTO bins VALUES('12345678901');
Query OK, 1 row affected, 1 warning (0.04 sec)
SELECT * FROM bins;
+------------+
| a |
+------------+
| 1234567890 |
+------------+
SET sql_mode='STRICT_ALL_TABLES';
INSERT INTO bins VALUES('12345678901');
ERROR 1406 (22001): Data too long for column 'a' at row 1Data Too Long
See Also
Last updated
Was this helpful?

