Row and Array Comparisons
来源:互联网 发布:python async def 编辑:程序博客网 时间:2024/06/01 09:19
http://www.postgresql.org/docs/9.3/static/functions-comparisons.html#AEN18448
Row-wise Comparison:
row的定义:http://www.postgresql.org/docs/9.3/static/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS
row与row的比较可以使用符号:
=, <>, <, <=, > or >=
digoal=# select row(a.foosubid) from foo a limit 1; row ----- (2)(1 row)digoal=# select row(a.foosubid) = row(2) from foo a limit 1; ?column? ---------- t(1 row)digoal=# select row(a.foosubid) = row('2') from foo a limit 1; ?column? ---------- t(1 row)digoal=# select row(a.foosubid) = row(22) from foo a limit 1; ?column? ---------- f(1 row)
is distinct from:
Any,All:digoal=# select row(a.foosubid) is distinct from row(1) from foo a limit 1; ?column? ---------- t(1 row)digoal=# select row(a.foosubid) is distinct from row(2) from foo a limit 1; ?column? ---------- f(1 row)
array:http://www.postgresql.org/docs/9.3/static/arrays.html
expression operator ANY (array expression)expression operator SOME (array expression)
expression operator ALL (array expression)
demo:http://www.cnblogs.com/gaojian/p/3190737.html
digoal=# create table tx (a int, b int[], c int[][]); CREATE TABLEdigoal=# insert into tx values(1, '{1,2,3,4}', '{{1,2,3,4,5},{1,2,3,4,5}}');INSERT 0 1digoal=# insert into tx values(1, '{1,2,3,4}', '{{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5}}');INSERT 0 1digoal=# insert into tx values(1, '{1,2,3,4}', '{{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5},{4,2}}');ERROR: malformed array literal: "{{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5},{4,}}"LINE 1: insert into tx values(1, '{1,2,3,4}', '{{1,2,3,4,5},{1,2,3,4... ^digoal=# select * from tx; a | b | c ---+-----------+--------------------------------------- 1 | {1,2,3,4} | {{1,2,3,4,5},{1,2,3,4,5}} 1 | {1,2,3,4} | {{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5}}(2 rows)digoal=# select c[1][1] from tx; c --- 1 1(2 rows)digoal=# select c[0][0] from tx; c --- (2 rows)digoal=# select c[1][2] from tx; c --- 2 2(2 rows)digoal=# select * from tx where 4 =any( c); a | b | c ---+-----------+--------------------------------------- 1 | {1,2,3,4} | {{1,2,3,4,5},{1,2,3,4,5}} 1 | {1,2,3,4} | {{1,2,3,4,5},{1,2,3,4,5},{1,2,3,4,5}}(2 rows)digoal=# select * from tx where 4 =all( c); a | b | c ---+---+---(0 rows)digoal=# insert into tx values(1, '{1,2,3,4}', array[[1,2,3,4,5],[1,2,3,4,5],[1,2,3,4,5]]); INSERT 0 1digoal=# select 2= any( array(select fooid from foo)); ?column? ---------- t(1 row)
0 0
- Row and Array Comparisons
- useful function & operator & custom operator for Row and Array Comparisons
- Exchange the numbers of row and array of a two-dimensional array, and form a new two-dimensional ar
- JavaScript秘密花园 - scope, namespace, constructor, equality and comparisons
- JavaScript秘密花园 - scope, namespace, constructor, equality and comparisons
- JavaScript秘密花园 - scope, namespace, constructor, equality and comparisons
- [翻译]JavaScript秘密花园 - scope, namespace, constructor, equality and comparisons
- Effective STL appendix A Locales and Case-Insensitive String Comparisons
- row migeration and row chain
- Row Chaining and Row Migration
- Row Chaining and Row Migration
- Row Chaining and Migrating
- 获取row chain and row Migration
- 14.9 InnoDB Row Storage and Row Formats
- Oracle Row Chaining and Migration
- MYSQL 参考指南 assoc、array、row
- 有序矩阵中查找第k小的元素 Kth smallest element in a row-wise and column-wise sorted 2D array
- URAL 1177 Like Comparisons
- HTML5 学习记录
- parser切词&全文检索
- postgres-xc
- 继承
- System Administration Functions
- Row and Array Comparisons
- ALTER TABLE rewrites
- python 字符编码处理问题总结 彻底击碎乱码!
- vacuum和vacuum full区别
- return setof
- 英特尔也在研究无人驾驶汽车 欲搭载自家处理器
- 聚合
- 嵌入式 RTP协议详解以及其他相关协议
- create type/cast/ENUM