中文字幕日韩精品一区二区免费_精品一区二区三区国产精品无卡在_国精品无码专区一区二区三区_国产αv三级中文在线

MySQL常見(jiàn)str函數(shù)

MySQL常見(jiàn)的字符串函數(shù)

創(chuàng)新互聯(lián)建站專注于企業(yè)全網(wǎng)營(yíng)銷推廣、網(wǎng)站重做改版、廣宗網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、html5、購(gòu)物商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營(yíng)銷網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為廣宗等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。

整理自官檔。

1.1     SUBSTR or SUBSTRING

SUBSTR(str,pos), SUBSTR(str FROM pos),SUBSTR(str,pos,len), SUBSTR(str FROM

pos FOR len)

SUBSTR() is a synonym for SUBSTRING().

SUBSTRING(str,pos), SUBSTRING(str FROM pos),SUBSTRING(str,pos,len),

SUBSTRING(str FROM pos FOR len)

The forms without a len argument return asubstring from string str starting at position pos.

The forms with a len argument return asubstring len characters long from string str, starting at

position pos. The forms that use FROM arestandard SQL syntax. It is also possible to use a negative

value for pos. In this case, the beginningof the substring is pos characters from the end of the

string, rather than the beginning. Anegative value may be used for pos in any of the forms of this

function.

For all forms of SUBSTRING(), the positionof the first character in the string from which the

substring is to be extracted is reckoned as1.

mysql> SELECTSUBSTRING('Quadratically',5);

-> 'ratically'

mysql> SELECT SUBSTRING('foobarbar' FROM4);

-> 'barbar'

mysql> SELECTSUBSTRING('Quadratically',5,6);

-> 'ratica'

mysql> SELECT SUBSTRING('Sakila', -3);

-> 'ila'

mysql> SELECT SUBSTRING('Sakila', -5,3);

-> 'aki'

mysql> SELECT SUBSTRING('Sakila' FROM -4FOR 2);

-> 'ki'

This function is multibyte safe.

If len is less than 1,the result is the empty string.

1.2     SUBSTRING_INDEX

SUBSTRING_INDEX(str,delim,count)

Returns the substring from string strbefore count occurrences of the delimiter delim. If count

is positive, everything to the left of thefinal delimiter (counting from the left) is returned. If count

is negative, everything to the right of thefinal delimiter (counting from the right) is returned.

SUBSTRING_INDEX() performs a case-sensitivematch when searching for delim.

mysql> SELECTSUBSTRING_INDEX('www.mysql.com', '.', 2);

-> 'www.mysql'

mysql> SELECTSUBSTRING_INDEX('www.mysql.com', '.', -2);

-> 'mysql.com'

This function is multibyte safe.

1.3     CHAR_LENGTH

CHAR_LENGTH(str) 返回字符數(shù)

Returns the length of the string str,measured in characters. A multibyte character counts as a

single character. This means that for astring containing five 2-byte characters, LENGTH() returns

10, whereas CHAR_LENGTH() returns 5.

1.4     LENGTH

LENGTH(str) 返回字節(jié)數(shù)

Returns the length of the string str,measured in bytes. A multibyte character counts as multiple

bytes. This means that for a stringcontaining five 2-byte characters, LENGTH() returns 10, whereas

CHAR_LENGTH() returns 5.

mysql> SELECT LENGTH('text');

分享文章:MySQL常見(jiàn)str函數(shù)
網(wǎng)站網(wǎng)址:http://www.rwnh.cn/article30/pgsiso.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、關(guān)鍵詞優(yōu)化企業(yè)網(wǎng)站制作、響應(yīng)式網(wǎng)站網(wǎng)站維護(hù)、Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都app開(kāi)發(fā)公司
收藏| 阜阳市| 法库县| 和静县| 定西市| 刚察县| 若羌县| 中西区| 星子县| 剑阁县| 新建县| 江阴市| 五河县| 金溪县| 阳西县| 固始县| 新民市| 稻城县| 通渭县| 大埔区| 扎兰屯市| 阳新县| 阳西县| 社会| 华宁县| 屏山县| 龙里县| 辉县市| 精河县| 九龙城区| 峡江县| 同心县| 太原市| 漠河县| 永城市| 连江县| 福州市| 根河市| 莱阳市| 永川市| 彭泽县|