type

BINARY

MySQL fixed-length byte strings are padded with zero bytes. PostgreSQL uses BYTEA instead of this declaration. Example target: MySQL 8.4. Run in a disposable database; examples need no existing tables.

Formal Syntax & Structure

sql syntaxsql
BINARY(n)

Working Example

Example Snippetsql
SELECT HEX(CAST('A' AS BINARY(3)));
SQL Reference