I created the following test pattern:
CREATE TABLE t (
a VARCHAR(32) BINARY,
b VARBINARY(32)
);
INSERT INTO t (a, b) VALUES ( 'test ', 'test ');
INSERT INTO t (a, b) VALUES ( 'test \0', 'test \0');
But this query did not show the difference between the two types:
SELECT a, LENGTH(a), HEX(a), b, LENGTH(b), HEX(b) FROM t;
a LENGTH(a) HEX(a) b LENGTH(b) HEX(b)
test 8 7465737420202020 test 8 7465737420202020
test 9 746573742020202000 test 9 746573742020202000
source
share