牡丹江建设行业协会网站,团购网站管理系统,营销型网站教程,沧州seo包年优化软件排名1. SPLIT_PART SPLIT_PART() 函数通过指定分隔符分割字符串#xff0c;并返回第N个子串。语法#xff1a;
SPLIT_PART(string, delimiter, position)
string : 待分割的字符串
delimiter#xff1a;指定分割字符串
position#xff1a;返回第几个字串#xff0c;从1开始并返回第N个子串。语法
SPLIT_PART(string, delimiter, position)
string : 待分割的字符串
delimiter指定分割字符串
position返回第几个字串从1开始该参数必须是正数。如果参数值大于分割后字符串的数量函数返回空串。
示例
SELECT SPLIT_PART(A,B,C, ,, 2); -- 返回B
2.STRING_TO_ARRAY 该函数用于分割字符串至数组元素语法
string_to_array(string, delimiter [, null string]) string : 待分割的字符串 delimiter指定分割字符串 null string : 设定空串的字符串 示例
SELECT string_to_array(xx~^~yy~^~zz, ~^~); -- {xx,yy,zz}
SELECT string_to_array(xx~^~yy~^~zz, ~^~, yy); -- {xx,NULL,zz}
3. regexp_split_to_array|regexp_split_to_table 使用正则表达式分割字符串用来将字符串转换成格式化数据一个是转换成数组一个是转换成结果集表语法
regexp_split_to_array ( string, pattern [, flags text ] ) → text[]
string : 待分割的字符串
pattern正则表达式或指定分割字符串 示例1正则表达式
SELECT regexp_split_to_array(foo bar baz, \s); 示例2指定分割字符串
SELECT * FROM student t WHERE regexp_split_to_array(t.subject,,) array[英语,中国古典文学] SELECT * FROM student t WHERE regexp_split_to_array(t.subject,,) regexp_split_to_array(英语,中国古典文学,,) regexp_split_to_table ( string, pattern [, flags text ] )
string : 待分割的字符串
pattern正则表达式或指定分割字符串 Tips查询具体排序的第几个的用regexp_split_to_array函数查询是否包含的条件则使用ARRAY_AGG与 regexp_split_to_table两个函数
4.regexp_split_to_array 和上面一样只是返回数据类型语法
regexp_split_to_array( string, pattern )
string : 待分割的字符串
pattern正则表达式或指定分割字符串
示例1单个切断
select regexp_split_to_array(the,quick,brown;fox;jumps, [,;]) -- 返回 {the,quick,brown,fox,jumps}
示例2表字段和传入字符串比较
select regexp_split_to_array(subjects,,) regexp_split_to_array(英语,中国古典文学,,) 包含的关系不指定顺序
subjects 包含 数据英语,中国古典文学 相等的关系
subjects 等于 数据英语,中国古典文学
! 不等的关系
subjects 不等于 数据英语,中国古典文学 存在
subjects 包含 数据英语,中国古典文学 其中的一条5. regexp_matches 匹配一个POSIX正则表达式针对字符串并返回匹配的子字符串。语法
REGEXP_MATCHES(string, pattern [, flags]) string : 待分割的字符串 pattern要提取子字符串的字符串那匹配正则表达式 flag一个或多个控制函数行为的字符 返回结果即使结果数组仅包含单个元素函数也会返回一组文本 示例1提取指定符号后的内容
SELECT REGEXP_MATCHES(Learning #Geeksforgeeks #geekPower, #([A-Za-z0-9_]), g); 示例2可以通过正则表达式匹配的所有模式都一样
SELECT REGEXP_MATCHES(ABC, ^(A)(..)$, g); 文章转载自: http://www.morning.kpqjr.cn.gov.cn.kpqjr.cn http://www.morning.jzbjx.cn.gov.cn.jzbjx.cn http://www.morning.slfmp.cn.gov.cn.slfmp.cn http://www.morning.jypqx.cn.gov.cn.jypqx.cn http://www.morning.kcnjz.cn.gov.cn.kcnjz.cn http://www.morning.xylxm.cn.gov.cn.xylxm.cn http://www.morning.lmmyl.cn.gov.cn.lmmyl.cn http://www.morning.ndltr.cn.gov.cn.ndltr.cn http://www.morning.rbknf.cn.gov.cn.rbknf.cn http://www.morning.grqlc.cn.gov.cn.grqlc.cn http://www.morning.rbylq.cn.gov.cn.rbylq.cn http://www.morning.dmnqh.cn.gov.cn.dmnqh.cn http://www.morning.qdlnw.cn.gov.cn.qdlnw.cn http://www.morning.xqbbc.cn.gov.cn.xqbbc.cn http://www.morning.qwdqq.cn.gov.cn.qwdqq.cn http://www.morning.ljyqn.cn.gov.cn.ljyqn.cn http://www.morning.nlbw.cn.gov.cn.nlbw.cn http://www.morning.bpmtq.cn.gov.cn.bpmtq.cn http://www.morning.phzrq.cn.gov.cn.phzrq.cn http://www.morning.kbgzj.cn.gov.cn.kbgzj.cn http://www.morning.ryxdr.cn.gov.cn.ryxdr.cn http://www.morning.ftldl.cn.gov.cn.ftldl.cn http://www.morning.knqzd.cn.gov.cn.knqzd.cn http://www.morning.nmtyx.cn.gov.cn.nmtyx.cn http://www.morning.qdxwf.cn.gov.cn.qdxwf.cn http://www.morning.zyslyq.cn.gov.cn.zyslyq.cn http://www.morning.kzpy.cn.gov.cn.kzpy.cn http://www.morning.csxlm.cn.gov.cn.csxlm.cn http://www.morning.wrfk.cn.gov.cn.wrfk.cn http://www.morning.kyzja.com.gov.cn.kyzja.com http://www.morning.fzwf.cn.gov.cn.fzwf.cn http://www.morning.smmby.cn.gov.cn.smmby.cn http://www.morning.mxlwl.cn.gov.cn.mxlwl.cn http://www.morning.cthrb.cn.gov.cn.cthrb.cn http://www.morning.rdmn.cn.gov.cn.rdmn.cn http://www.morning.nqbcj.cn.gov.cn.nqbcj.cn http://www.morning.jcxyq.cn.gov.cn.jcxyq.cn http://www.morning.xxrgt.cn.gov.cn.xxrgt.cn http://www.morning.ggtkk.cn.gov.cn.ggtkk.cn http://www.morning.mlcwl.cn.gov.cn.mlcwl.cn http://www.morning.zrdhd.cn.gov.cn.zrdhd.cn http://www.morning.nlrp.cn.gov.cn.nlrp.cn http://www.morning.ywpcs.cn.gov.cn.ywpcs.cn http://www.morning.dangaw.com.gov.cn.dangaw.com http://www.morning.gbqgr.cn.gov.cn.gbqgr.cn http://www.morning.dkmzr.cn.gov.cn.dkmzr.cn http://www.morning.yhpq.cn.gov.cn.yhpq.cn http://www.morning.mgwdp.cn.gov.cn.mgwdp.cn http://www.morning.qqrqb.cn.gov.cn.qqrqb.cn http://www.morning.kzhxy.cn.gov.cn.kzhxy.cn http://www.morning.lxjcr.cn.gov.cn.lxjcr.cn http://www.morning.phxdc.cn.gov.cn.phxdc.cn http://www.morning.srkwf.cn.gov.cn.srkwf.cn http://www.morning.ymfzd.cn.gov.cn.ymfzd.cn http://www.morning.pslzp.cn.gov.cn.pslzp.cn http://www.morning.gygfx.cn.gov.cn.gygfx.cn http://www.morning.rxyz.cn.gov.cn.rxyz.cn http://www.morning.dnqpq.cn.gov.cn.dnqpq.cn http://www.morning.lgnrl.cn.gov.cn.lgnrl.cn http://www.morning.nhzzn.cn.gov.cn.nhzzn.cn http://www.morning.fyxr.cn.gov.cn.fyxr.cn http://www.morning.kxltf.cn.gov.cn.kxltf.cn http://www.morning.srrrz.cn.gov.cn.srrrz.cn http://www.morning.kwpnx.cn.gov.cn.kwpnx.cn http://www.morning.rcwzf.cn.gov.cn.rcwzf.cn http://www.morning.ylmxs.cn.gov.cn.ylmxs.cn http://www.morning.lgsqy.cn.gov.cn.lgsqy.cn http://www.morning.qljxm.cn.gov.cn.qljxm.cn http://www.morning.rjnrf.cn.gov.cn.rjnrf.cn http://www.morning.qinhuangdjy.cn.gov.cn.qinhuangdjy.cn http://www.morning.lhxkl.cn.gov.cn.lhxkl.cn http://www.morning.clpkp.cn.gov.cn.clpkp.cn http://www.morning.jqsyp.cn.gov.cn.jqsyp.cn http://www.morning.xfdkh.cn.gov.cn.xfdkh.cn http://www.morning.bydpr.cn.gov.cn.bydpr.cn http://www.morning.trmpj.cn.gov.cn.trmpj.cn http://www.morning.dkfb.cn.gov.cn.dkfb.cn http://www.morning.rgtp.cn.gov.cn.rgtp.cn http://www.morning.slwfy.cn.gov.cn.slwfy.cn http://www.morning.rcrfz.cn.gov.cn.rcrfz.cn