Home > Database > Mysql Tutorial > What kind of string comparisons can MySQL perform (case-sensitive or insensitive)?

What kind of string comparisons can MySQL perform (case-sensitive or insensitive)?

王林
Release: 2023-09-12 08:05:02
forward
1168 people have browsed it

MySQL 可以执行什么样的字符串比较(区分大小写或不区分大小写)?

#MySQL cannot perform case-sensitive comparisons when comparing characters. This can be illustrated by the following example from table 'Employee':

mysql> Select * from Employee;
+----+--------+--------+
| ID | Name   | Salary |
+----+--------+--------+
| 1  | Gaurav | 50000  |
| 2  | Rahul  | 20000  |
| 3  | Advik  | 25000  |
| 4  | Aarav  | 65000  |
| 5  | Ram    | 20000  |
| 6  | Mohan  | 30000  |
| 7  | Aryan  | NULL   |
| 8  | Vinay  | NULL   |
+----+--------+--------+
8 rows in set (0.09 sec)
Copy after login

The result set of the following query shows that MySQL is not case sensitive when comparing characters.

mysql> Select * from Employee WHERE Name IN ('gaurav','RAM');
+----+--------+--------+
| ID | Name   | Salary |
+----+--------+--------+
| 1  | Gaurav | 50000  |
| 5  | Ram    | 20000  |
+----+--------+--------+
2 rows in set (0.00 sec)
Copy after login

The above is the detailed content of What kind of string comparisons can MySQL perform (case-sensitive or insensitive)?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template