国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 青海省| 手机| 阜宁县| 万年县| 米脂县| 泾源县| 阳曲县| 屏东市| 东海县| 高雄县| 丽水市| 老河口市| 延庆县| 廉江市| 嫩江县| 东辽县| 龙里县| 南江县| 广元市| 延津县| 二连浩特市| 南丰县| 石河子市| 金阳县| 运城市| 宝丰县| 拉萨市| 霍州市| 江陵县| 聂拉木县| 扎兰屯市| 弋阳县| 松滋市| 潜山县| 丹阳市| 日土县| 卓尼县| 宁化县| 成武县| 乃东县| 洱源县|