In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.