MariaDB: Why is LOCATE using case sensitive comparison?
I have a database with the following data in the "Name" column:
However, running the following query returns incorrect results:
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0)
Returns:
Calgary Northeast
Test Location
Calgary West
However its not returning "Southern BC" which has an s
at the beginning. According to the MariaDB docs, the LOCATE
function is case-insensitive (see: https://mariadb.com/kb/en/library/locate/), so I would expect "Southern BC" and "Calgary South" to show in the results. It's clear my query is doing a case sensitive comparison but I don't know why. All of my collations are set to utf8mb4_general_ci
everywhere I have checked.
SELECT TABLE_SCHEMA
, TABLE_NAME
, TABLE_COLLATION
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME ='Regions';
returns utf8mb4_general_ci
SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';
returns
collation_connection utf8mb4_general_ci
collation_database utf8mb4_general_ci
collation_server utf8mb4_general_ci
I'm running 10.3.10-MariaDB-1:10.3.10+maria~bionic-log
Any idea on this behavior?
sql mariadb
add a comment |
I have a database with the following data in the "Name" column:
However, running the following query returns incorrect results:
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0)
Returns:
Calgary Northeast
Test Location
Calgary West
However its not returning "Southern BC" which has an s
at the beginning. According to the MariaDB docs, the LOCATE
function is case-insensitive (see: https://mariadb.com/kb/en/library/locate/), so I would expect "Southern BC" and "Calgary South" to show in the results. It's clear my query is doing a case sensitive comparison but I don't know why. All of my collations are set to utf8mb4_general_ci
everywhere I have checked.
SELECT TABLE_SCHEMA
, TABLE_NAME
, TABLE_COLLATION
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME ='Regions';
returns utf8mb4_general_ci
SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';
returns
collation_connection utf8mb4_general_ci
collation_database utf8mb4_general_ci
collation_server utf8mb4_general_ci
I'm running 10.3.10-MariaDB-1:10.3.10+maria~bionic-log
Any idea on this behavior?
sql mariadb
Please setup a dbfiddle.uk ; select mariadb 10.3 from the list in the top left corner. It will help in debugging. Something about the table structure may have been missed. Maybe the charset to be used at the time of making database connection is set to binary.
– Madhur Bhaiya
Nov 14 '18 at 5:16
add a comment |
I have a database with the following data in the "Name" column:
However, running the following query returns incorrect results:
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0)
Returns:
Calgary Northeast
Test Location
Calgary West
However its not returning "Southern BC" which has an s
at the beginning. According to the MariaDB docs, the LOCATE
function is case-insensitive (see: https://mariadb.com/kb/en/library/locate/), so I would expect "Southern BC" and "Calgary South" to show in the results. It's clear my query is doing a case sensitive comparison but I don't know why. All of my collations are set to utf8mb4_general_ci
everywhere I have checked.
SELECT TABLE_SCHEMA
, TABLE_NAME
, TABLE_COLLATION
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME ='Regions';
returns utf8mb4_general_ci
SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';
returns
collation_connection utf8mb4_general_ci
collation_database utf8mb4_general_ci
collation_server utf8mb4_general_ci
I'm running 10.3.10-MariaDB-1:10.3.10+maria~bionic-log
Any idea on this behavior?
sql mariadb
I have a database with the following data in the "Name" column:
However, running the following query returns incorrect results:
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0)
Returns:
Calgary Northeast
Test Location
Calgary West
However its not returning "Southern BC" which has an s
at the beginning. According to the MariaDB docs, the LOCATE
function is case-insensitive (see: https://mariadb.com/kb/en/library/locate/), so I would expect "Southern BC" and "Calgary South" to show in the results. It's clear my query is doing a case sensitive comparison but I don't know why. All of my collations are set to utf8mb4_general_ci
everywhere I have checked.
SELECT TABLE_SCHEMA
, TABLE_NAME
, TABLE_COLLATION
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME ='Regions';
returns utf8mb4_general_ci
SHOW VARIABLES LIKE 'character_set%';
SHOW VARIABLES LIKE 'collation%';
returns
collation_connection utf8mb4_general_ci
collation_database utf8mb4_general_ci
collation_server utf8mb4_general_ci
I'm running 10.3.10-MariaDB-1:10.3.10+maria~bionic-log
Any idea on this behavior?
sql mariadb
sql mariadb
edited Nov 14 '18 at 16:05
Rick James
68.2k559100
68.2k559100
asked Nov 14 '18 at 4:14
BradBrad
3,184103952
3,184103952
Please setup a dbfiddle.uk ; select mariadb 10.3 from the list in the top left corner. It will help in debugging. Something about the table structure may have been missed. Maybe the charset to be used at the time of making database connection is set to binary.
– Madhur Bhaiya
Nov 14 '18 at 5:16
add a comment |
Please setup a dbfiddle.uk ; select mariadb 10.3 from the list in the top left corner. It will help in debugging. Something about the table structure may have been missed. Maybe the charset to be used at the time of making database connection is set to binary.
– Madhur Bhaiya
Nov 14 '18 at 5:16
Please setup a dbfiddle.uk ; select mariadb 10.3 from the list in the top left corner. It will help in debugging. Something about the table structure may have been missed. Maybe the charset to be used at the time of making database connection is set to binary.
– Madhur Bhaiya
Nov 14 '18 at 5:16
Please setup a dbfiddle.uk ; select mariadb 10.3 from the list in the top left corner. It will help in debugging. Something about the table structure may have been missed. Maybe the charset to be used at the time of making database connection is set to binary.
– Madhur Bhaiya
Nov 14 '18 at 5:16
add a comment |
3 Answers
3
active
oldest
votes
You can do either
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0) OR (LOCATE('S', `e`.`Name`) > 0)
OR
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE e.name like '%S%' or e.name like '%s%'
add a comment |
I can't reproduce the problem:
MariaDB [_]> SELECT VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.3.10-MariaDB |
+-----------------+
1 row in set (0.000 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.002 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'collation%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_general_ci |
| collation_server | utf8mb4_general_ci |
+----------------------+--------------------+
3 rows in set (0.001 sec)
MariaDB [_]> DROP TABLE IF EXISTS `Regions`;
Query OK, 0 rows affected (0.005 sec)
MariaDB [_]> CREATE TABLE IF NOT EXISTS `Regions` (
-> `Name` VARCHAR(255)
-> );
Query OK, 0 rows affected (0.010 sec)
MariaDB [_]> INSERT INTO `Regions`
-> VALUES
-> ('Calgary South'),
-> ('Calgary Northeast'),
-> ('Calgary Location'),
-> ('Location'),
-> ('Calgary West'),
-> ('Calgary BC'),
-> ('Southern BC');
Query OK, 7 rows affected (0.004 sec)
Records: 7 Duplicates: 0 Warnings: 0
MariaDB [_]> SELECT `Name`
-> FROM `Regions`;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary Location |
| Location |
| Calgary West |
| Calgary BC |
| Southern BC |
+-------------------+
7 rows in set (0.000 sec)
MariaDB [_]> SELECT `Name`
-> FROM `Regions`
-> WHERE LOCATE('s', `Name`) > 0;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary West |
| Southern BC |
+-------------------+
4 rows in set (0.001 sec)
add a comment |
Please provide SHOW CREATE TABLE
. The collation of name
is significant.
If you are using the default collation or some other ..._ci
collation, then this is suitable:
WHERE e.name LIKE '%s%'
to catch uppercase and lowercase s
.
LIKE
and REGEXP
are appropriate for checking for substrings. LOCATE
is appropriate for finding the position of something in a string.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53293106%2fmariadb-why-is-locate-using-case-sensitive-comparison%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can do either
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0) OR (LOCATE('S', `e`.`Name`) > 0)
OR
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE e.name like '%S%' or e.name like '%s%'
add a comment |
You can do either
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0) OR (LOCATE('S', `e`.`Name`) > 0)
OR
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE e.name like '%S%' or e.name like '%s%'
add a comment |
You can do either
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0) OR (LOCATE('S', `e`.`Name`) > 0)
OR
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE e.name like '%S%' or e.name like '%s%'
You can do either
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE (LOCATE('s', `e`.`Name`) > 0) OR (LOCATE('S', `e`.`Name`) > 0)
OR
SELECT `e`.`Id`, `e`.`Name`
FROM `Regions` AS `e`
WHERE e.name like '%S%' or e.name like '%s%'
answered Nov 14 '18 at 4:21
tabarnecktabarneck
328
328
add a comment |
add a comment |
I can't reproduce the problem:
MariaDB [_]> SELECT VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.3.10-MariaDB |
+-----------------+
1 row in set (0.000 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.002 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'collation%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_general_ci |
| collation_server | utf8mb4_general_ci |
+----------------------+--------------------+
3 rows in set (0.001 sec)
MariaDB [_]> DROP TABLE IF EXISTS `Regions`;
Query OK, 0 rows affected (0.005 sec)
MariaDB [_]> CREATE TABLE IF NOT EXISTS `Regions` (
-> `Name` VARCHAR(255)
-> );
Query OK, 0 rows affected (0.010 sec)
MariaDB [_]> INSERT INTO `Regions`
-> VALUES
-> ('Calgary South'),
-> ('Calgary Northeast'),
-> ('Calgary Location'),
-> ('Location'),
-> ('Calgary West'),
-> ('Calgary BC'),
-> ('Southern BC');
Query OK, 7 rows affected (0.004 sec)
Records: 7 Duplicates: 0 Warnings: 0
MariaDB [_]> SELECT `Name`
-> FROM `Regions`;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary Location |
| Location |
| Calgary West |
| Calgary BC |
| Southern BC |
+-------------------+
7 rows in set (0.000 sec)
MariaDB [_]> SELECT `Name`
-> FROM `Regions`
-> WHERE LOCATE('s', `Name`) > 0;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary West |
| Southern BC |
+-------------------+
4 rows in set (0.001 sec)
add a comment |
I can't reproduce the problem:
MariaDB [_]> SELECT VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.3.10-MariaDB |
+-----------------+
1 row in set (0.000 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.002 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'collation%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_general_ci |
| collation_server | utf8mb4_general_ci |
+----------------------+--------------------+
3 rows in set (0.001 sec)
MariaDB [_]> DROP TABLE IF EXISTS `Regions`;
Query OK, 0 rows affected (0.005 sec)
MariaDB [_]> CREATE TABLE IF NOT EXISTS `Regions` (
-> `Name` VARCHAR(255)
-> );
Query OK, 0 rows affected (0.010 sec)
MariaDB [_]> INSERT INTO `Regions`
-> VALUES
-> ('Calgary South'),
-> ('Calgary Northeast'),
-> ('Calgary Location'),
-> ('Location'),
-> ('Calgary West'),
-> ('Calgary BC'),
-> ('Southern BC');
Query OK, 7 rows affected (0.004 sec)
Records: 7 Duplicates: 0 Warnings: 0
MariaDB [_]> SELECT `Name`
-> FROM `Regions`;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary Location |
| Location |
| Calgary West |
| Calgary BC |
| Southern BC |
+-------------------+
7 rows in set (0.000 sec)
MariaDB [_]> SELECT `Name`
-> FROM `Regions`
-> WHERE LOCATE('s', `Name`) > 0;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary West |
| Southern BC |
+-------------------+
4 rows in set (0.001 sec)
add a comment |
I can't reproduce the problem:
MariaDB [_]> SELECT VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.3.10-MariaDB |
+-----------------+
1 row in set (0.000 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.002 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'collation%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_general_ci |
| collation_server | utf8mb4_general_ci |
+----------------------+--------------------+
3 rows in set (0.001 sec)
MariaDB [_]> DROP TABLE IF EXISTS `Regions`;
Query OK, 0 rows affected (0.005 sec)
MariaDB [_]> CREATE TABLE IF NOT EXISTS `Regions` (
-> `Name` VARCHAR(255)
-> );
Query OK, 0 rows affected (0.010 sec)
MariaDB [_]> INSERT INTO `Regions`
-> VALUES
-> ('Calgary South'),
-> ('Calgary Northeast'),
-> ('Calgary Location'),
-> ('Location'),
-> ('Calgary West'),
-> ('Calgary BC'),
-> ('Southern BC');
Query OK, 7 rows affected (0.004 sec)
Records: 7 Duplicates: 0 Warnings: 0
MariaDB [_]> SELECT `Name`
-> FROM `Regions`;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary Location |
| Location |
| Calgary West |
| Calgary BC |
| Southern BC |
+-------------------+
7 rows in set (0.000 sec)
MariaDB [_]> SELECT `Name`
-> FROM `Regions`
-> WHERE LOCATE('s', `Name`) > 0;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary West |
| Southern BC |
+-------------------+
4 rows in set (0.001 sec)
I can't reproduce the problem:
MariaDB [_]> SELECT VERSION();
+-----------------+
| VERSION() |
+-----------------+
| 10.3.10-MariaDB |
+-----------------+
1 row in set (0.000 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.002 sec)
MariaDB [_]> SHOW VARIABLES LIKE 'collation%';
+----------------------+--------------------+
| Variable_name | Value |
+----------------------+--------------------+
| collation_connection | utf8mb4_general_ci |
| collation_database | utf8mb4_general_ci |
| collation_server | utf8mb4_general_ci |
+----------------------+--------------------+
3 rows in set (0.001 sec)
MariaDB [_]> DROP TABLE IF EXISTS `Regions`;
Query OK, 0 rows affected (0.005 sec)
MariaDB [_]> CREATE TABLE IF NOT EXISTS `Regions` (
-> `Name` VARCHAR(255)
-> );
Query OK, 0 rows affected (0.010 sec)
MariaDB [_]> INSERT INTO `Regions`
-> VALUES
-> ('Calgary South'),
-> ('Calgary Northeast'),
-> ('Calgary Location'),
-> ('Location'),
-> ('Calgary West'),
-> ('Calgary BC'),
-> ('Southern BC');
Query OK, 7 rows affected (0.004 sec)
Records: 7 Duplicates: 0 Warnings: 0
MariaDB [_]> SELECT `Name`
-> FROM `Regions`;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary Location |
| Location |
| Calgary West |
| Calgary BC |
| Southern BC |
+-------------------+
7 rows in set (0.000 sec)
MariaDB [_]> SELECT `Name`
-> FROM `Regions`
-> WHERE LOCATE('s', `Name`) > 0;
+-------------------+
| Name |
+-------------------+
| Calgary South |
| Calgary Northeast |
| Calgary West |
| Southern BC |
+-------------------+
4 rows in set (0.001 sec)
answered Nov 14 '18 at 15:52
wchiquitowchiquito
11.9k22134
11.9k22134
add a comment |
add a comment |
Please provide SHOW CREATE TABLE
. The collation of name
is significant.
If you are using the default collation or some other ..._ci
collation, then this is suitable:
WHERE e.name LIKE '%s%'
to catch uppercase and lowercase s
.
LIKE
and REGEXP
are appropriate for checking for substrings. LOCATE
is appropriate for finding the position of something in a string.
add a comment |
Please provide SHOW CREATE TABLE
. The collation of name
is significant.
If you are using the default collation or some other ..._ci
collation, then this is suitable:
WHERE e.name LIKE '%s%'
to catch uppercase and lowercase s
.
LIKE
and REGEXP
are appropriate for checking for substrings. LOCATE
is appropriate for finding the position of something in a string.
add a comment |
Please provide SHOW CREATE TABLE
. The collation of name
is significant.
If you are using the default collation or some other ..._ci
collation, then this is suitable:
WHERE e.name LIKE '%s%'
to catch uppercase and lowercase s
.
LIKE
and REGEXP
are appropriate for checking for substrings. LOCATE
is appropriate for finding the position of something in a string.
Please provide SHOW CREATE TABLE
. The collation of name
is significant.
If you are using the default collation or some other ..._ci
collation, then this is suitable:
WHERE e.name LIKE '%s%'
to catch uppercase and lowercase s
.
LIKE
and REGEXP
are appropriate for checking for substrings. LOCATE
is appropriate for finding the position of something in a string.
answered Nov 14 '18 at 16:10
Rick JamesRick James
68.2k559100
68.2k559100
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53293106%2fmariadb-why-is-locate-using-case-sensitive-comparison%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please setup a dbfiddle.uk ; select mariadb 10.3 from the list in the top left corner. It will help in debugging. Something about the table structure may have been missed. Maybe the charset to be used at the time of making database connection is set to binary.
– Madhur Bhaiya
Nov 14 '18 at 5:16