mysql>
SELECT * FROM t1 WHERE MATCH a AGAINST ('----' IN BOOLEAN MODE);
+------+
| a
|
+------+
| ---- |
+------+
1 row in set (0.00 sec)
12.10. Cast Functions and Operators
Table 12.14. Cast Functions
Name
[948]
BINARY
[948]
CAST()
CONVERT()
•
BINARY
The
BINARY
to force a column comparison to be done byte by byte rather than character by character. This
causes the comparison to be case sensitive even if the column is not defined as
[948]
BINARY
mysql>
SELECT 'a' = 'A';
-> 1
mysql>
SELECT BINARY 'a' = 'A';
-> 0
mysql>
SELECT 'a' = 'a ';
-> 1
mysql>
SELECT BINARY 'a' = 'a ';
-> 0
In a comparison,
with the same result.
BINARY str
Note that in some contexts, if you cast an indexed column to BINARY, MySQL is not able to use the
index efficiently.
•
CAST(expr AS type)
The
CAST()
specified type, similar to
information.
•
CONVERT(expr,type)
The
CONVERT()
result value of a specified type.
The
type
•
BINARY[(N)]
•
CHAR[(N)]
•
DATE
•
DATETIME
•
DECIMAL[(M[,D])]
Cast Functions and Operators
[948]
[948]
[948]
operator casts the string following it to a binary string. This is an easy way
also causes trailing spaces to be significant.
[948]
BINARY
[948]
is shorthand for
[948]
[948]
function takes an expression of any type and produces a result value of a
CONVERT()
[948],
[948]
and
CAST()
for the result can be one of the following values:
Description
Cast a string to a binary string
Cast a value as a certain type
Cast a value as a certain type
affects the entire operation; it can be given before either operand
CAST(str AS BINARY)
[948]. See the description of
CONVERT(expr USING transcoding_name)
[948]
functions take an expression of any type and produce a
948
BINARY
[948].
[948]
CONVERT()
[948]
or BLOB.
for more
Need help?
Do you have a question about the 5.0 and is the answer not in the manual?
Questions and answers