暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

【AntDB数据库 SQL语法专栏】——常用函数(12)

gyz 2023-08-25
334

示例

antdb=# select array_append(ARRAY[1,2], 3); array_append -------------- {1,2,3} (1 row) antdb=# select array_cat(ARRAY[1,2,3], ARRAY[4,5]); array_cat ------------- {1,2,3,4,5} (1 row) antdb=# select array_ndims(ARRAY[[1,2,3], [4,5,6]]); array_ndims ------------- 2 (1 row) antdb=# select array_dims(ARRAY[[1,2,3], [4,5,6]]); array_dims ------------ [1:2][1:3] (1 row) antdb=# select array_fill(7, ARRAY[3], ARRAY[2]); array_fill --------------- [2:4]={7,7,7} (1 row) antdb=# select array_length(array[1,2,3], 1); array_length -------------- 3 (1 row) antdb=# select array_lower('[0:2]={1,2,3}'::int[], 1); array_lower ------------- 0 (1 row) antdb=# select array_position(ARRAY['sun','mon','tue','wed','thu','fri','sat'], 'mon'); array_position ---------------- 2 (1 row) antdb=# select array_positions(ARRAY['A','A','B','A'], 'A'); array_positions ----------------- {1,2,4} (1 row) antdb=# select array_prepend(1, ARRAY[2,3]); array_prepend --------------- {1,2,3} (1 row) antdb=# select array_remove(ARRAY[1,2,3,2], 2); array_remove -------------- {1,3} (1 row) antdb=# select array_replace(ARRAY[1,2,5,4], 5, 3); array_replace --------------- {1,2,3,4} (1 row) antdb=# select array_to_string(ARRAY[1, 2, 3, NULL, 5], ',', '*'); array_to_string ----------------- 1,2,3,*,5 (1 row) antdb=# select array_upper(ARRAY[1,8,3,7], 1); array_upper ------------- 4 (1 row) antdb=# select cardinality(ARRAY[[1,2],[3,4]]); cardinality ------------- 4 (1 row) antdb=# select string_to_array('xx~^~yy~^~zz', '~^~', 'yy'); string_to_array ----------------- {xx,NULL,zz} (1 row) antdb=# select unnest(ARRAY[1,2]); unnest -------- 1 2 (2 rows)
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论