国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

MySQL 尋常str函數(shù)

2024-07-24 12:36:23
字體:
供稿:網(wǎng)友
  MySQL常見的字符串函數(shù)
 
  整理自官檔。
 
  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 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    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');

(編輯:武林網(wǎng))

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 长春市| 通渭县| 天全县| 临桂县| 岚皋县| 肥乡县| 武乡县| 泰州市| 溆浦县| 温州市| 尖扎县| 兴业县| 许昌县| 花垣县| 望奎县| 南宁市| 正阳县| 昭觉县| 云龙县| 策勒县| 日土县| 阳新县| 陇南市| 和硕县| 北安市| 山丹县| 融水| 固阳县| 迭部县| 凤山市| 甘孜| 民丰县| 乌拉特前旗| 洪雅县| 钟祥市| 内乡县| 安国市| 合作市| 奉化市| 通州市| 西峡县|