Description\n-----------\n\nThe BINARY type is similar to the CHAR type, but stores binary byte strings rather than non-binary character strings. M represents the column length in bytes.\n\nIt contains no character set, and comparison and sorting are based on the numeric value of the bytes.\n\nIf the maximum length is exceeded, and SQL strict mode is not enabled , the extra characters will be dropped with a warning. If strict mode is enabled, an error will occur.\n\nBINARY values are right-padded with 0x00 (the zero byte) to the specified length when inserted. The padding is _not_ removed on select, so this needs to be taken into account when sorting and comparing, where all bytes are significant. The zero byte, 0x00 is less than a space for comparison purposes.\n\nUse Cases for Zero Length\n\nA BINARY(0) or VARBINARY(0) column is restricted to an empty byte string or NULL.\n\n Schema Preservation: Use these columns when a system expects a specific column to exist, but no data storage is required for your current application.\n Space-Efficient Indicators: These columns can act as a two-state indicator where the presence of an empty byte string represents one state and NULL represents another.\n\nIf you attempt to insert a value other than an empty string, MariaDB returns an ERROR 1406 (22001) indicating the data is too long for the column.\n\nExamples\n--------\n\nCREATE TABLE bins (a BINARY(10));\n\nINSERT INTO bins VALUES('12345678901');\nQuery OK, 1 row affected, 1 warning (0.04 sec)\n\nSELECT * FROM bins;\n+------------+\n| a          |\n+------------+\n| 1234567890 |\n+------------+\n\nSET sql_mode='STRICT_ALL_TABLES';\n\nINSERT INTO bins VALUES('12345678901');\nERROR 1406 (22001): Data too long for column 'a' at row 1\n\nURL: https://mariadb.com/docs/server/reference/data-types/string-data-types/binary