BINARY doesn't affect how the column is stored or retrieved. Note that My SQL's behaviour in this regard is the diametrical opposite of the default behaviour of most other databases.
(Tested: DB2 8.1, Firebird 1.5.1, Oracle 8.1.7 and Postgre SQL 7.4.3, details of other databases welcome). However, in contrast to CHAR, VARCHAR values are stored using only as many characters as are needed, plus one byte to record the length.
It has been fixed in the 4.1.x series, but remains in earlier versions.
Other databases tested (DB2 8.1, Firebird 1.5rc4, Oracle 8.1.7 and Postgre SQL 7.3) displayed the query results as expected with no truncation. There are two options here: 1) the database throws an error and your app either deals with it gracefully or fails.
(For known bugs see this page in the My SQL documentation:
The My SQL database server is being continually improved.
The only exception found is Firebird 1.02, which went into an infinite loop; this problem seems to be fixed in Firebird 1.5.
(This space removal differs from the SQL-99 specification.) ...(And if you're thinking "implement them in the application", you don't need a relational database). Values in CHAR and VARCHAR columns are sorted and compared in case-insensitive fashion, unless the BINARY attribute was specified when the table was created.The BINARY attribute means that column values are sorted and compared in case-sensitive fashion according to the ASCII order of the machine where the My SQL server is running.Possibly this is because My SQL internally adds an extra "digit" to store a minus sign, and because the storage space is there uses it with positive numbers to pack an extra digit in, if the explanation here: anything to go by.Other databases (tested: Firebird 1.5rc4, Oracle 8.1.7 and Postgre SQL 7.4) raised errors with the same data.