In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces how to use LPAD () and RPAD () function in MySQL, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
LPAD () / RPAD ()
The LPAD (str,len,padstr) function represents that the left side of the string str is populated with padstr until the len;RPAD (str,len,padstr) function indicates that the right side of the string str is filled with padstr until the length is len. For example:
SELECT LPAD (123,6,'0') AS str1, LPAD (123,2,'0') AS str2, RPAD (123,6,'0') AS str1, RPAD (123,2,'0') AS str1;str1 | str2 | str1 | str1 |-+-- +-+-- 000123 | 12 | 123000 | 12 |
When the length of the string str is greater than len, it is equivalent to truncating the string from the right.
In addition, the REPEAT (str,count) function is used to copy the string str count times and return the result. For example:
SELECT REPEAT ('?', 5) AS str;str |-+? | Thank you for reading this article carefully. I hope the article "how to use the LPAD () and RPAD () function in MySQL shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!"
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.