有一个数组[10,20],我想知道它是否是数组[20,30,10] 的子集。是否有 postgresql 函数或操作来确定一个数组是否包含另一个数组?
期望的结果:
[10,20] and [30,20,10] - true
[10,20] and [10,30] - false
[10,20] and [20,10] - true
[10,20] and [10,20] - true
最佳答案
像这样,也许:
SELECT ARRAY[10,20] <@ ARRAY[30,20,10];
http://www.postgresql.org/docs/current/static/functions-array.html
关于sql - 检查数组是否包含在 PostgreSQL 中的另一个数组中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20923577/