PostgresSQL 数组包含@>
原文链接:http://www.postgresql.org/docs/9.5/static/functions-array.html
9.18. Array Functions and Operators
Table 9-45 shows the operators available for array types.
Table 9-45. Array Operators
Operator Description Example Result = equal ARRAY[1.1,2.1,3.1]::int[] = ARRAY[1,2,3] t <> not equal ARRAY[1,2,3] <> ARRAY[1,2,4] t < less than ARRAY[1,2,3] < ARRAY[1,2,4] t > greater than ARRAY[1,4,3] > ARRAY[1,2,4] t <= less than or equal ARRAY[1,2,3] <= ARRAY[1,2,3] t >= greater than or equal ARRAY[1,4,3] >= ARRAY[1,4,3] t @> contains ARRAY[1,4,3] @> ARRAY[3,1] t <@ is contained by ARRAY[2,7] <@ ARRAY[1,7,4,2,6] t && overlap (have elements in common) ARRAY[1,4,3] && ARRAY[2,1] t || array-to-array concatenation ARRAY[1,2,3] || ARRAY[4,5,6] {1,2,3,4,5,6} || array-to-array concatenation ARRAY[1,2,3] || ARRAY[[4,5,6],[7,8,9]] {{1,2,3},{4,5,6},{7,8,9}} || element-to-array concatenation 3 || ARRAY[4,5,6] {3,4,5,6} || array-to-element concatenation ARRAY[4,5,6] || 7 {4,5,6,7} Array comparisons compare the array contents element-by-element, using the default B-tree comparison function for the element data type. In multidimensional arrays the elements are visited in row-major order (last subscript varies most rapidly). If the contents of two arrays are equal but the dimensionality is different, the first difference in the dimensionality information determines the sort order. (This is a change from versions of PostgreSQL prior to 8.2: older versions would claim that two arrays with the same contents were equal, even if the number of dimensions or subscript ranges were different.)
See Section 8.15 for more details about array operator behavior. See Section 11.2 for more details about which operators support indexed operations.
Table 9-46 shows the functions available for use with array types. See Section 8.15 for more information and examples of the use of these functions.
Table 9-46. Array Functions
Function Return Type Description Example Result array_append
(anyarray,anyelement)anyarray append an element to the end of an array array_append(ARRAY[1,2], 3) {1,2,3} array_cat
(anyarray,anyarray)anyarray concatenate two arrays array_cat(ARRAY[1,2,3], ARRAY[4,5]) {1,2,3,4,5} array_ndims
(anyarray)int returns the number of dimensions of the array array_ndims(ARRAY[[1,2,3], [4,5,6]]) 2 array_dims
(anyarray)text returns a text representation of array's dimensions array_dims(ARRAY[[1,2,3], [4,5,6]]) [1:2][1:3] array_fill
(anyelement,int[], [, int[]])anyarray returns an array initialized with supplied value and dimensions, optionally with lower bounds other than 1 array_fill(7, ARRAY[3], ARRAY[2]) [2:4]={7,7,7} array_length
(anyarray,int)int returns the length of the requested array dimension array_length(array[1,2,3], 1) 3 array_lower
(anyarray,int)int returns lower bound of the requested array dimension array_lower('[0:2]={1,2,3}'::int[], 1) 0 array_position
(anyarray,anyelement [, int])int returns the subscript of the first occurrence of the second argument in the array, starting at the element indicated by the third argument or at the first element (array must be one-dimensional) array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'mon') 2 array_positions
(anyarray,anyelement)int[] returns an array of subscripts of all occurrences of the second argument in the array given as first argument (array must be one-dimensional) array_positions(ARRAY['A','A','B','A'], 'A') {1,2,4} array_prepend
(anyelement,anyarray)anyarray append an element to the beginning of an array array_prepend(1, ARRAY[2,3]) {1,2,3} array_remove
(anyarray,anyelement)anyarray remove all elements equal to the given value from the array (array must be one-dimensional) array_remove(ARRAY[1,2,3,2], 2) {1,3} array_replace
(anyarray,anyelement, anyelement)anyarray replace each array element equal to the given value with a new value array_replace(ARRAY[1,2,5,4], 5, 3) {1,2,3,4} array_to_string
(anyarray,text [, text])text concatenates array elements using supplied delimiter and optional null string array_to_string(ARRAY[1, 2, 3, NULL, 5], ',', '*') 1,2,3,*,5 array_upper
(anyarray,int)int returns upper bound of the requested array dimension array_upper(ARRAY[1,8,3,7], 1) 4 cardinality
(anyarray)int returns the total number of elements in the array, or 0 if the array is empty cardinality(ARRAY[[1,2],[3,4]]) 4 string_to_array
(text,text [, text])text[] splits string into array elements using supplied delimiter and optional null string string_to_array('xx~^~yy~^~zz', '~^~', 'yy') {xx,NULL,zz} unnest
(anyarray)setof anyelement expand an array to a set of rows unnest(ARRAY[1,2]) 1
2(2 rows)
unnest
(anyarray, anyarray[, ...])setof anyelement, anyelement [, ...] expand multiple arrays (possibly of different types) to a set of rows. This is only allowed in the FROM clause; see Section 7.2.1.4 unnest(ARRAY[1,2],ARRAY['foo','bar','baz']) 1 foo
2 bar
NULL baz(3 rows)
In
array_position
andarray_positions
, each array element is compared to the searched value using IS NOT DISTINCT FROM semantics.In
array_position
, NULL is returned if the value is not found.In
array_positions
, NULL is returned only if the array is NULL; if the value is not found in the array, an empty array is returned instead.In
string_to_array
, if the delimiter parameter is NULL, each character in the input string will become a separate element in the resulting array. If the delimiter is an empty string, then the entire input string is returned as a one-element array. Otherwise the input string is split at each occurrence of the delimiter string.In
string_to_array
, if the null-string parameter is omitted or NULL, none of the substrings of the input will be replaced by NULL. Inarray_to_string
, if the null-string parameter is omitted or NULL, any null elements in the array are simply skipped and not represented in the output string.Note: There are two differences in the behavior of
string_to_array
from pre-9.1 versions ofPostgreSQL. First, it will return an empty (zero-element) array rather than NULL when the input string is of zero length. Second, if the delimiter string is NULL, the function splits the input into individual characters, rather than returning NULL as before.
PostgresSQL 数组包含@>的更多相关文章
- js 判断数组包含某值的方法 和 javascript数组扩展indexOf()方法
var questionId = []; var anSwerIdValue = []; ////javascript数组扩展indexOf()方法 Array.prototype.indexOf ...
- JS 判断数组包含某个字符
//arrDisable 数组 infoType 字符 if($.inArray(infoType, arrDisable)) { console.log('包含'); }
- 基础作业 本周没上课,但是请大家不要忘记学习。 本周请大家完成上周挑战作业的第一部分:给定一个整数数组(包含正负数),找到一个具有最大和的子数组,返回其最大的子数组的和。 例如:[1, -2, 3, 10, -4, 7, 2, -5]的最大子数组为[3, 10, -4, 7, 2] 输入: 请建立以自己英文名字命名的txt文件,并输入数组元素数值,元素值之间用逗号分隔。 输出 在不删除原有文件内容
1丶 实验代码 #include<stdio.h> int main(void) { int tt,nn,i,j,c[11][11]; int flag=1; scanf("%d ...
- js怎么把一个数组里面的值作为一个属性添加到另一数组包含的对象里(小程序)
上面这个需求我说的似乎不太明白,之前也是没有碰到过,也是最近在搞小程序,涉及到小程序前后台数据交互,展示的部分!!不太明白没关系等会我给大家举个例子,就明白了说起来有点拗口,一看就明白了,其实如果是原 ...
- 数组包含字典-根据key排序
NSArray *array = [NSArray array]; [array sortedArrayUsingComparator:^NSComparisonResult(id obj1, id ...
- .net 拆分字符串成数数组 包含使用空格 逗号 回车 换行符等
简单的代码如下: public static string[] GetProductList(string inputstring) { char[] split ...
- js 数组包含
function(arr,element){ return new RegExp('(^|,)'+element.toString()+'(,|$)').test(arr.toString()); }
- js数组定义和方法 (包含ES5新增数组方法)
数组Array 1. 数组定义 一系列数据的集合成为数组.数组的元素可以为任何类型的数据(包括数组,函数等),每个元素之间用逗号隔开,数组格式:[1,2,3]. 2. 数组创建方式 (1) 字面量方法 ...
- js和jQuery判断数组是否包含指定元素
最近遇见一些前台基础性问题,在这里笔者觉得有必要记录一下,为了以后自己查阅或者读者查看. 已知var arr = ['java','js','php','C++']; 问题:arr数组是否包含‘jav ...
随机推荐
- Keras 可视化 model
参考:https://keras.io/visualization/ error解决参考:http://blog.csdn.net/wangjian1204/article/details/50346 ...
- Java笔记(八)
GUI: awt和swing: java.awt:Abstract Window ToolKit(抽象窗口工具包),需要调用本地系统方法实现功能.属于重量级控件. javax.swing:在awt的基 ...
- npm 引入第三方过滤器
根据项目具体情况使用过滤器,如果不满足业务需求可以在vue的全局或者局部自定义fiter(过滤器) 一下是github提供的第三方过滤器: https://github.com/freearhey/v ...
- 利用PDF.JS插件解决了本地pdf文件在线浏览问题(根据需要隐藏下载功能,只保留打印功能)
我是在IE11和谷歌上做的测试,都可以显示,把做出的东西记录下来,方便大家还有自己学习! 可以在IIS7服务器上也可以下载Tomcat来做服务器 Tomcat下载地址 http://pan.bai ...
- 2.6 hive分区表
一.背景 ######### 分区表实际上就是对应一个HDFS文件系统上的独立的文件夹,该文件夹下是该分区所有的数据文件. Hive中的分区就是分目录,把一个大的数据集根据业务需要分割成更小的数据集. ...
- Identity Server 4 原理和实战(完结)_Hybrid Flow 实例, Claims, 角色授权和策略授权
4分50 建立客户端 不需要身份认证 客户端叫做HybirdClient 配置IdentityServer服务端,先把客户端添加上 把userClaims添加到token里面 然后运行服务端就可以了 ...
- VS Supercharger插件
一.前言 Supercharger 是 VS 的一款插件,针对代码进行优化和着色,便于观察和区分. 二.下载及安装 下载的 URL 如下:Supercharger 下载地址 点击下载,下载完成以后,那 ...
- 51nod 1376【线段树维护区间最大值】
引自:wonter巨巨的博客 定义 dp[i] := 以数字 i(不是下标 i)为结尾的最长上升长度 然后用线段树维护 dp[i]: 每个节点维护 2 个信息,一个是当前区间的最大上升长度,一个是最大 ...
- 計蒜客/小教官(xjb)
題目鏈接:https://nanti.jisuanke.com/t/366 題意:中文題誒~ 思路: 先通過給出的條件構造一個符合題意的數組(可以是任意一個符合條件的數組,菜雞不會證明: 然後構造的數 ...
- 【POJ - 3040】Allowance(贪心)
Allowance 原文是English,这里就放Chinese了 Descriptions: 作为创纪录的牛奶生产的奖励,农场主约翰决定开始给Bessie奶牛一个小的每周津贴.FJ有一套硬币N种(1 ...