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

Is MySQL's SELECT Query Case-Sensitive?

Mary-Kate Olsen
Release: 2024-12-10 20:19:10
Original
453 people have browsed it

Is MySQL's SELECT Query Case-Sensitive?

MySQL SELECT Query Case Sensitivity

When executing a SELECT query in MySQL, it's important to consider whether the query is case sensitive or case insensitive by default. By default, MySQL queries are case insensitive, meaning they ignore the case of the values being compared.

However, suppose you need to perform a case-sensitive comparison. In that case, you can use the BINARY keyword in your query. For example, to search for a specific value in a column with a case-sensitive comparison, you can use a query like this:

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

In this query, the BINARY keyword forces MySQL to perform a case-sensitive comparison, ensuring that the query will only return rows where the Value column exactly matches the specified value, regardless of case.

The above is the detailed content of Is MySQL's SELECT Query 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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template