Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How mysql queries are case sensitive

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how mysql query is case-sensitive, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

In mysql, you can use select query statements with binary keywords for case sensitivity, select statements for querying data, and binary keywords for case sensitivity, with the syntax "select * from table name WHERE binary field = field value".

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How mysql queries are case sensitive

Queries are case-sensitive by default in mysql, but not case-sensitive by default in mysql.

Solution:

Mysql can add binary to the SQL statement to be case-sensitive. BINARY is not a function, it is a type conversion operator, and it is used to force the string after it to be a binary string, which can be understood to be case-sensitive when comparing strings.

1. Add binary to the query statement

Select * from users WHERE binary user_name = 'Zhang San' AND status! = 0

Second, add binary when building the table

Create table t {code varchar (10) binary} ALTER TABLE t_order CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin

After executing the sql above, the query on the table is case-sensitive.

The above is all the contents of the article "how mysql queries are case-sensitive". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report