SQL Postgres

 

下面列出来一些常用的SQL 语句:

字符串操作:https://www.cnblogs.com/alianbog/p/5656722.html

1. regexp_split_to_table(field_name,separator)
把某个字段的值 拆分成结果集
2.regexp_split_to_array(field_name,separator) 
把某个字段的值 拆分成数组 
3.array_length(regexp_split_to_array(field_name,separator) ,1)
计算拆分后数组的长度,1表示维度
4.SPLIT_PART(field_name,separator,1)
取出分割后的数组的第1的元素
5. SUBSTRING(name,LENGTH(name))
取出 name的最后一个字符

聚合函数:http://www.postgres.cn/docs/9.3/functions-aggregate.html

string_agg(field_name,separator) 把某列的值合并成字符串;

hstore函数:http://www.postgres.cn/docs/9.5/hstore.html

猜你喜欢

转载自www.cnblogs.com/dasheng-maritime/p/9237207.html