国产精品电影_久久视频免费_欧美日韩国产激情_成年人视频免费在线播放_日本久久亚洲电影_久久都是精品_66av99_九色精品美女在线_蜜臀a∨国产成人精品_冲田杏梨av在线_欧美精品在线一区二区三区_麻豆mv在线看

PostgreSQL字符串函數(shù)

開發(fā) 前端 PostgreSQL
PostgreSQL的字符串函數(shù)主要用于字符串操作。

PostgreSQL的字符串函數(shù)主要用于字符串操作。下表詳細(xì)介紹了重要的字符串函數(shù):

 

ASCII(str)

Returns the numeric value of the leftmost character of the string str. Returns 0 if str is the empty string. Returns NULL if str is NULL. ASCII() works for characters with numeric values from 0 to 255.

  1. testdb=# SELECT ASCII('2'); 
  2. +---------------------------------------------------------+ 
  3. | ASCII('2')                                              | 
  4. +---------------------------------------------------------+ 
  5. | 50                                                      | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 
  8.  
  9. testdb=# SELECT ASCII('dx'); 
  10. +---------------------------------------------------------+ 
  11. | ASCII('dx')                                             | 
  12. +---------------------------------------------------------+ 
  13. | 100                                                     | 
  14. +---------------------------------------------------------+ 
  15. 1 row in set (0.00 sec) 

BIT_LENGTH(str)

返回位字符串str的長度。

  1. testdb=# SELECT BIT_LENGTH('text'); 
  2. +---------------------------------------------------------+ 
  3. | BIT_LENGTH('text')                                      | 
  4. +---------------------------------------------------------+ 
  5. | 32                                                      | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

 CHAR_LENGTH(str)

Returns the length of the string str, measured in characters. A multi-byte character counts as a single character. This means that for a string containing five two-byte characters, LENGTH() returns 10, whereas CHAR_LENGTH() returns 5。

  1. testdb=# SELECT CHAR_LENGTH('text'); 
  2. +---------------------------------------------------------+ 
  3. | CHAR_LENGTH('text')                                     | 
  4. +---------------------------------------------------------+ 
  5. | 4                                                       | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

CHARACTER_LENGTH(str)

CHARACTER_LENGTH() is a synonym for CHAR_LENGTH()。

 CONCAT(str1,str2,...)

Returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are non-binary strings, the result is a non-binary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; if you want to avoid that, you can use an explicit type cast, as in this example:

  1. testdb=# SELECT CONCAT('My''S''QL'); 
  2. +---------------------------------------------------------+ 
  3. | CONCAT('My''S''QL')                                 | 
  4. +---------------------------------------------------------+ 
  5. | MySQL                                                   | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

#p#

CONCAT_WS(separator,str1,str2,...)

CONCAT_WS() stands for Concatenate With Separator and is a special form of CONCAT(). The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL。

  1. testdb=# SELECT CONCAT_WS(',','First name','Last Name' ); 
  2. +---------------------------------------------------------+ 
  3. | CONCAT_WS(',','First name','Last Name' )                | 
  4. +---------------------------------------------------------+ 
  5. First nameLast Name                                   | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

 LCASE(str)

LCASE() is a synonym for LOWER()。

LEFT(str,len)

Returns the leftmost len characters from the string str, or NULL if any argument is NULL。

  1. testdb=# SELECT LEFT('foobarbar', 5); 
  2. +---------------------------------------------------------+ 
  3. LEFT('foobarbar', 5)                                    | 
  4. +---------------------------------------------------------+ 
  5. | fooba                                                   | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

 LENGTH(str)

Returns the length of the string str, measured in bytes. A multi-byte character counts as multiple bytes. This means that for a string containing five two-byte characters, LENGTH() returns 10, whereas CHAR_LENGTH() returns 5。

  1. testdb=# SELECT LENGTH('text'); 
  2. +---------------------------------------------------------+ 
  3. | LENGTH('text')                                          | 
  4. +---------------------------------------------------------+ 
  5. | 4                                                       | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

 LOWER(str)

Returns the string str with all characters changed to lowercase according to the current character set mapping.

  1. testdb=# SELECT LOWER('QUADRATICALLY'); 
  2. +---------------------------------------------------------+ 
  3. LOWER('QUADRATICALLY')                                  | 
  4. +---------------------------------------------------------+ 
  5. | quadratically                                           | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

 LPAD(str,len,padstr)

Returns the string str, left-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters.

  1. testdb=# SELECT LPAD('hi',4,'??'); 
  2. +---------------------------------------------------------+ 
  3. | LPAD('hi',4,'??')                                       | 
  4. +---------------------------------------------------------+ 
  5. | ??hi                                                    | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

LTRIM(str)

Returns the string str with leading space characters removed.

  1. testdb=# SELECT LTRIM('  barbar'); 
  2. +---------------------------------------------------------+ 
  3. | LTRIM('  barbar')                                       | 
  4. +---------------------------------------------------------+ 
  5. | barbar                                                  | 
  6. +---------------------------------------------------------+ 
  7. 1 row in set (0.00 sec) 

MID(str,pos,len)

MID(str,pos,len) is a synonym for SUBSTRING(str,pos,len).

POSITION(substr IN str)

POSITION(substr IN str) is a synonym for LOCATE(substr,str).

QUOTE_IDENT(string text), QUOTE_LITERAL(string text), QUOTE_LITERAL(value anyelement), QUOTE_NULLABLE(value anyelement)

All these functions return the given string suitably quoted to be used as an identifier in an SQL statement string. In the function QUOTE_IDENT, Quotes are added only if necessary. In function QUOTE_LITERAL, embedded single-quotes and backslashes are properly doubled. If a value is passed, coerce the given value to text and then quote it as a literal. The function QUOTE_NULLABLE, coerces the given value to text and then quote it as a literal; or, if the argument is null, return NULL.

Following are the examples for all these functions:

  1. testdb=# SELECT QUOTE_IDENT('Foo bar'); 
  2.  quote_ident 
  3. ------------- 
  4.  "Foo bar" 
  5. (1 row) 
  6.  
  7.  
  8. testdb=# SELECT QUOTE_LITERAL(E'O\'Reilly'); 
  9.  quote_literal 
  10. --------------- 
  11.  'O''Reilly' 
  12. (1 row) 
  13.  
  14.  
  15. testdb=# SELECT QUOTE_LITERAL(42.5); 
  16.  quote_literal 
  17. --------------- 
  18.  '42.5' 
  19. (1 row) 
  20.  
  21.  
  22. testdb=# SELECT QUOTE_NULLABLE(42.5); 
  23.  quote_nullable 
  24. ---------------- 
  25.  '42.5' 
  26. (1 row) 

#p#

expr REGEXP pattern

REGEXP_MATCHES(string text, pattern text [, flags text]) function performs a pattern match of expr against pattern. Returns 1 if expr matches pat; otherwise it returns 0. If either expr or pat is NULL, the result is NULL. REGEXP_MATCHES is not case sensitive, except when used with binary strings.

REGEXP_REPLACE(string text, pattern text, replacement text [, flags text]) function replaces substring(s) matching a POSIX regular expression.

REGEXP_SPLIT_TO_ARRAY(string text, pattern text [, flags text ]), Split string using a POSIX regular expression as the delimiter.

REGEXP_SPLIT_TO_TABLE(string text, pattern text [, flags text]), splits string using a POSIX regular expression as the delimiter.

Following are the examples for all these functions:

  1. testdb=# SELECT REGEXP_MATCHES('ABCDEF' ,'A%C%%'); 
  2.  regexp_matches 
  3. ---------------- 
  4. (0 rows
  5.  
  6.  
  7. testdb=# SELECT REGEXP_REPLACE('Thomas''.[mN]a.''M'); 
  8.  regexp_replace 
  9. ---------------- 
  10.  ThM 
  11. (1 row) 
  12.  
  13.  
  14. testdb=# SELECT REGEXP_SPLIT_TO_ARRAY('hello world', E'\\s+'); 
  15.  regexp_split_to_array 
  16. ----------------------- 
  17.  {hello,world} 
  18. (1 row) 
  19.  
  20.  
  21. testdb=# SELECT REGEXP_SPLIT_TO_TABLE('hello world', E'\\s+'); 
  22.  regexp_split_to_table 
  23. ----------------------- 
  24.  hello 
  25.  world 
  26. (2 rows

 REPEAT(str,count)

Returns a string consisting of the string str repeated count times. If count is less than 1, returns an empty string. Returns NULL if str or count are NULL。

  1. testdb=# SELECT REPEAT('SQL', 3); 
  2.   repeat 
  3. ----------- 
  4.  SQLSQLSQL 
  5. (1 row) 

 REPLACE(str,from_str,to_str)

Returns the string str with all occurrences of the string from_str replaced by the string to_str. REPLACE() performs a case-sensitive match when searching for from_st

  1. testdb=# SELECT REPLACE('www.mysql.com''w''Ww'); 
  2.      replace 
  3. ------------------ 
  4.  WwWwWw.mysql.com 
  5. (1 row) 

 REVERSE(str)

Returns the string str with the order of the characters reversed.

  1. testdb=# SELECT REVERSE('abcd'); 
  2.  reverse 
  3. --------- 
  4.  dcba 
  5. (1 row) 

 RIGHT(str,len)

Returns the rightmost len characters from the string str, or NULL if any argument is NULL。

  1. testdb=# SELECT RIGHT('foobarbar', 4); 
  2.  right 
  3. ------- 
  4.  rbar 
  5. (1 row) 

 RPAD(str,len,padstr)

Returns the string str, right-padded with the string padstr to a length of len characters. If str is longer than len, the return value is shortened to len characters。

  1. testdb=# SELECT RPAD('hi',5,'?'); 
  2.  rpad 
  3. ------- 
  4.  hi??? 
  5. (1 row) 

 RTRIM(str)

Returns the string str with trailing space characters removed.

  1. testdb=# SELECT RTRIM('barbar   '); 
  2.  rtrim 
  3. -------- 
  4.  barbar 
  5. (1 row) 

#p# 

SUBSTRING(str,pos)

SUBSTRING(str FROM pos)

SUBSTRING(str,pos,len)

SUBSTRING(str FROM pos FOR len)

The forms without a len argument return a substring from string str starting at position pos. The forms with a len argument return a substring len characters long from string str, starting at position pos. The forms that use FROM are standard SQL syntax. It is also possible to use a negative value for pos. In this case, the beginning of the substring is pos characters from the end of the string, rather than the beginning. A negative value may be used for pos in any of the forms of this function。

  1. testdb=# SELECT SUBSTRING('Quadratically',5);  
  2.  substring  
  3. -----------  
  4.  ratically  
  5. (1 row)  
  6.   
  7.   
  8. testdb=# SELECT SUBSTRING('foobarbar' FROM 4);  
  9.  substring  
  10. -----------  
  11.  barbar  
  12. (1 row)  
  13.   
  14.   
  15. testdb=# SELECT SUBSTRING('Quadratically',5,6);  
  16.  substring  
  17. -----------  
  18.  ratica  
  19. (1 row)  

TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str)

TRIM([remstr FROM] str)

Returns the string str with all remstr prefixes or suffixes removed. If none of the specifiers BOTH, LEADING, or TRAILING is given, BOTH is assumed. remstr

  1. testdb=# SELECT TRIM('  bar   '); 
  2.  btrim 
  3. ------- 
  4.  bar 
  5. (1 row) 
  6.  
  7.  
  8. testdb=# SELECT TRIM(LEADING 'x' FROM 'xxxbarxxx'); 
  9.  ltrim 
  10. -------- 
  11.  barxxx 
  12. (1 row) 
  13.  
  14.  
  15. testdb=# SELECT TRIM(BOTH 'x' FROM 'xxxbarxxx'); 
  16.  btrim 
  17. ------- 
  18.  bar 
  19. (1 row) 
  20.  
  21.  
  22. testdb=# SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz'); 
  23.  rtrim 
  24. ------- 
  25.  bar 
  26. (1 row) 

UCASE(str)

UCASE() is a synonym for UPPER().

UPPER(str)

Returns the string str with all characters changed to uppercase according to the current character set mapping.

  1. testdb=# SELECT UPPER('manisha'); 
  2.   upper 
  3. --------- 
  4.  MANISHA 
  5. (1 row) 

 

原文鏈接:http://www.yiibai.com/html/postgresql/2013/080893.html

 

責(zé)任編輯:陳四芳 來源: yiibai.com
相關(guān)推薦

2010-09-09 11:48:00

SQL函數(shù)字符串

2010-10-09 11:54:46

MySQL字符串

2009-11-24 09:55:44

PHP字符串函數(shù)

2009-08-06 16:01:09

C#字符串函數(shù)大全

2010-11-26 10:14:40

MySQL repla

2010-07-14 16:35:52

Perl字符串處理函數(shù)

2010-11-08 17:07:41

SQL Server字

2010-11-26 09:46:26

MySQL字符串相加

2010-05-26 15:36:23

MySQL字符串

2010-09-06 17:30:46

SQL函數(shù)

2009-07-15 17:20:45

Jython字符串

2010-05-26 15:14:39

MySQL字符串

2009-02-24 14:27:55

2009-12-01 10:38:08

PHP字符串函數(shù)

2010-07-19 15:07:46

Perl字符串處理函數(shù)

2009-11-18 12:38:04

PHP字符串函數(shù)

2011-07-15 11:07:41

C語言字符串函數(shù)

2011-07-15 12:41:53

C語言

2010-10-11 15:57:35

MySQL清除字符串

2009-02-24 15:39:27

字符串比較函數(shù)函數(shù)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

欧美日韩精品在线视频| 国产精品手机在线| 亚洲成人tv网| 你懂的视频在线一区二区| 欧美福利一区| 国产精品2018| 亚洲一区色图| 久久99精品国产99久久| 国产精品x453.com| 91亚洲精品一区| 亚洲黄色三级| 高清日韩一区| 欧美亚洲国产激情| 日韩一区二区欧美| 成入视频在线观看| 国产精品福利在线播放| 亚洲最大免费| 超碰成人久久| 欧美精品videos性欧美| av基地在线| 亚州色图欧美色图| 欧美一区二区日韩一区二区| 精品剧情v国产在线观看| 精品国产一区二| 青青青伊人色综合久久| 亚洲高清在线精品| 免费日韩av电影| 538在线精品| 亚洲高清福利视频| 日韩欧美久久| 日韩电视剧在线观看免费网站| 国产高清一区视频| 国产毛片在线看| 国产精品亚洲一区二区三区在线| 制服.丝袜.亚洲.中文.综合| 只有这里有精品| 99精品在线观看| 国产91丝袜在线播放0| 国产精品nxnn| 97香蕉超级碰碰久久免费软件 | 亚欧美中日韩视频| 日韩欧美一区二区三区四区| 国产精品久久福利| 欧美xx视频| 亚洲人成网站色在线观看| 男人天堂av网站| 在线视频一区二区| 日韩精品免费一区二区三区| 伊人成色综合网| 亚洲欧洲精品成人久久奇米网| 成人亚洲性情网站www在线观看| 欧美另类z0zxhd电影| 成年人视频在线免费观看| 欧美大片免费久久精品三p | 国产精品99一区二区三| 日本成人黄色| 2020国产精品自拍| 国产熟人av一二三区| av影院午夜一区| 亚洲美女电影在线| 一区二区三视频| 久久国产剧场电影| 欧美精品在线免费观看| 最新国产在线视频| 亚洲欧美综合另类在线卡通| 成人在线视频亚洲| 啪一啪鲁一鲁2019在线视频| 国产 欧美在线| 91亚洲一区精品| 久久久一二三| 北条麻妃在线视频| 亚洲国产中文字幕| 超碰在线97国产| 亚洲人成在线播放| 97久久网站| 欧美日韩国产二区| 久久综合给合| 男人天堂手机在线视频| 91麻豆精品国产| 在线日韩影院| 51国偷自产一区二区三区 | 91在线播放网址| 国产欧美精品在线| 精品噜噜噜噜久久久久久久久试看 | 中文字幕日韩一区二区三区不卡| 精品色999| 久久久999免费视频| 一本久久综合亚洲鲁鲁| 国产精品自拍一区| 国产欧洲在线| 水莓100国产免费av在线播放| 2019亚洲男人天堂| 欧美人伦禁忌dvd放荡欲情| 久久成人在线| 久久久久毛片| 在线成人福利| www.黄色网址.com| 欧美成人免费在线观看| 亚洲精品国产精华液| 亚洲性色视频| 免费av不卡| 国产综合香蕉五月婷在线| 99久久伊人精品| av激情成人网| 国产av第一区| 亚洲区免费影片| 国产精品a久久久久| 久久久国产欧美| 欧美高清在线视频观看不卡| 国产精品456露脸| yourporn在线观看视频| 亚洲free性xxxx护士白浆| 亚洲欧洲制服丝袜| 亚洲欧美日韩国产手机在线| 都市激情亚洲欧美| 中国成人亚色综合网站| 欧美激情精品久久久久久蜜臀| 日韩欧美国产黄色| 视频一区视频二区中文| 欧美日韩伊人| 成人午夜一级| 人妻av无码专区| 亚洲mv大片欧洲mv大片精品| 性欧美videos高清hd4k| 国产精品一区=区| 成人精品小蝌蚪| 成人在线免费电影| 精品欧美一区二区久久久伦| 蜜月aⅴ免费一区二区三区 | 国产日韩影视精品| 午夜dj在线观看高清视频完整版| 欧美日韩福利电影| 亚洲激情综合| 色综合天天色综合| 久久精品亚洲一区| 蜜桃视频一区二区三区 | 成人在线影视| 3dmax动漫人物在线看| 精品久久久久久无码国产| 久草在线成人| 亚洲视频免费看| 久久蜜桃一区二区| 中国av一区二区三区| 国产女主播在线一区二区| av亚洲产国偷v产偷v自拍| 91麻豆国产精品久久| 粉嫩在线一区二区三区视频| 日本aⅴ免费视频一区二区三区 | 久久久久久久久久伊人| 97国产真实伦对白精彩视频8| 亚洲男人第一av网站| 欧美日韩激情一区| 亚洲六月丁香色婷婷综合久久| 成人在线免费观看网站| 黄视频免费在线看| 日本a在线播放| 亚洲人辣妹窥探嘘嘘| 99久久无色码| 日韩av电影手机在线| 日韩专区第三页| 国产亚洲一区在线播放| 欧美一区二区三级| 国产精品色哟哟网站| 欧美人狂配大交3d怪物一区| 亚洲小说欧美激情另类| 国产亚洲欧美在线| 免费a级毛片在线观看| 欧洲亚洲一区二区| 免费日韩中文字幕| 91吃瓜网在线观看| 少妇视频一区| 成人嫩草影院| 国产在线视频一区二区三区| 国产精品美女久久福利网站| 在线免费观看成人短视频| 伊人久久五月天| 国产精品久久久久久av福利软件| 国产乱码精品一区二区三区中文 | 国产精品国产精品国产专区不片| 亚洲欧美成人| 欧美韩日精品| 日韩中文字幕区一区有砖一区 | 亚洲女人天堂在线| 91大神网址| 污污视频在线| 免费短视频成人日韩| 国产一区 二区 三区一级| 亚洲成人中文| 亚洲美女性视频| 久久91超碰青草是什么| 成人综合电影| 国产三级免费观看| 色呦呦在线播放| 日韩在线观看| 亚洲色图视频网站| 精品无人码麻豆乱码1区2区| 波多野结衣在线aⅴ中文字幕不卡| 久久久精品一品道一区| 精品久久久久久亚洲国产300| 欧美影视一区在线|