Home > Database > Mysql Tutorial > Is MySQL's SELECT Statement Case-Sensitive?

Is MySQL's SELECT Statement Case-Sensitive?

DDD
Release: 2024-12-28 02:25:10
Original
331 people have browsed it

Is MySQL's SELECT Statement Case-Sensitive?

MySQL SELECT Statement Case Sensitivity

By default, MySQL SELECT queries are not case sensitive. This means that if you have a table with a column named Value, and you run a query like the following:

SELECT * FROM `table` WHERE `Value` = "iaresavage"
Copy after login

...it will return all rows where the Value column exactly matches "iaresavage", regardless of whether the data is stored in lowercase, uppercase, or mixed case.

However, if you want to perform a case-sensitive comparison, you can use the BINARY operator. For example, the following query would only return rows where the Value column exactly matches "IAreSavage":

SELECT * FROM `table` WHERE BINARY `Value` = "IAreSavage"
Copy after login

It's important to note that using the BINARY operator can impact performance, so it's best to only use it when necessary.

The above is the detailed content of Is MySQL's SELECT Statement Case-Sensitive?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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