In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to use the substr function in SQL. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
Substr (string, 1Pol 3) function interpretation: take a 3-word string from left to right in string.
The result is: str
From right to left?
There should be another function to provide this function!
In fact, from right to left, this function is just a difference in parameters.
Substr (String,-1,3) function interpretation: start with 3 digits from the right side of the string.
The result is: G
Substr (string,start,length)
String-the specified string to intercept. Start-required, specifies where to start the string. Positive number-starts at the specified position in the string, negative number-starts at the specified position at the end of the string, 0-starts at the first character in the string. Length-optional, specifies the length of the string to be intercepted, and by default returns all characters before the end of the value of the character expression.
For example: select substr ('abcdefg',3,4) from dual; result is cdef select substr (' abcdefg',-3,4) from dual; result efg
Note: the first position in the string is always 1. The results of the following two sql queries are the same:
For example: select substr ('abcdefg',0,3) from dual; result is abc
Select substr ('abcdefg',1,3) from dual; result is abc
Different from substring in the java class:
Substring (int beginIndex, int endIndex): starting at the specified beginIndex and ending at the specified endIndex-1, the first position in the string is always 0. EndIndex, optional, returns the character from the specified index to the end of the string by default.
For example: "unhappy" .substring (2) returns "happy"
"hamburger" .substring (3pm 8) returns "burge"
On how to use the substr function in SQL to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.