mysql怎么看大写 mysql57区分大小写( 二 )


INSERT
INTO
case_bin_test
VALUES
('Frank'),('Google'),('froogle'),('flickr'),('FlicKr');
Query
OK,
5
rows
affected
(0.00
sec)
Records:
5
Duplicates:
Warnings:
mysql
SELECT
*
FROM
case_bin_test
WHERE
word
LIKE
'f%';
+---------+
|
word
|
+---------+
|
froogle
|
|
flickr
|
+---------+
2
rows
in
set
(0.00
sec)
mysql
SELECT
*
FROM
case_bin_test
WHERE
word
LIKE
'F%';
+---------+
|
word
|
+---------+
|
Frank
|
|
FlicKr
|
+---------+
4
rows
in
set
(0.00
sec)
###########
#
End
###########
2、另外一种方法
###########
#
Start
case
sensitive
collation
example
###########
mysql
create
table
case_cs_test
(word
VARCHAR(10))
CHARACTER
SET
latin1
COLLATE
latin1_general_cs;
Query
OK,
rows
affected
(0.08
sec)
mysql
INSERT
INTO
case_cs_test
VALUES
('Frank'),('Google'),('froogle'),('flickr'),('FlicKr');
Query
OK,
5
rows
affected
(0.00
sec)
Records:
5
Duplicates:
Warnings:
mysql
SELECT
*
FROM
case_cs_test
WHERE
word
LIKE
'F%';
+---------+
|
word
|
+---------+
|
Frank
|
|
FlicKr
|
+---------+
4
rows
in
set
(0.00
sec)
mysql
SELECT
*
FROM
case_cs_test
WHERE
word
LIKE
'f%';
+---------+
|
word
|
+---------+
|
froogle
|
|
flickr
|
+---------+
2
rows
in
set
(0.00
sec)
###########
#
end
###########
3、还有一种方法就是在查询时指定collation
mysql
create
table
case_test
(word
VARCHAR(10))
CHARACTER
SET
latin1;
Query
OK,
rows
affected
(0.01
sec)
mysql
INSERT
INTO
case_test
VALUES
('Frank'),('Google'),('froogle'),('flickr'),('FlicKr');
Query
OK,
7
rows
affected
(0.01
sec)
Records:
7
Duplicates:
Warnings:
mysql
SELECT
*
FROM
case_test
WHERE
word
LIKE
'f%';
+---------+
|
word
|
+---------+
|
Frank
|
|
froogle
|
|
flickr
|
|
FlicKr
|
+---------+
6
rows
in
set
(0.01
sec)
mysql
SELECT
*
FROM
case_test
WHERE
word
LIKE
'F%';
+---------+
|
word
|
+---------+
|
Frank
|
|
froogle
|
|
flickr
|
|
FlicKr
|
+---------+
6
rows
in
set
(0.01
sec)
mysql
SELECT
*
FROM
case_test
WHERE
word
COLLATE
latin1_bin
LIKE
'F%';
+---------+
|
word
|
+---------+
|
Frank
|
|
FlicKr
|
+---------+
4
rows
in
set

推荐阅读