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 converts a string to lowercase

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Editor to share with you how mysql string to lowercase, I believe that most people do not understand, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Mysql string to lowercase method: 1, use LOWER () function, syntax "SELECT LOWER (str) [FROM data table name];"; 2, use LCASE () function, syntax "SELECT LCASE (str) [FROM data table name];".

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

Mysql converts strings to lowercase

1. Use the LOWER () function

The lowercase conversion function LOWER (str) converts all alphabetic characters in a string to lowercase.

SELECT LOWER (column_name) [FROM table_name]

Example 1: use the LOWER function to convert all alphabetic characters in a string to lowercase

Mysql > SELECT LOWER ('BLUE'), LOWER (' Blue') +-+-+ | LOWER ('BLUE') | LOWER (' Blue') | +-+-+ | blue | blue | +-+-+ 1 row in set (0.03 sec)

As can be seen from the results, all letters were converted to lowercase, such as "BLUE", and then converted to "blue"; strings with mixed uppercase and lowercase letters were converted to lowercase letters, such as "Blue", and then converted to "bule".

Example 2: convert text in "CustomerName" to lowercase

SELECT LCASE (CustomerName) AS LowercaseCustomerNameFROM Customers

2. Use the LCASE () function

LCASE () is synonymous with LOWER ().

The LCASE () function converts the value of the field to lowercase.

SELECT LCASE (str) [FROM table_name]

Example: convert text in "CustomerName" to lowercase

SELECT LCASE (CustomerName) AS LowercaseCustomerNameFROM Customers; above is all the content of the article "how to convert a string to lowercase by mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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