array类型
1.数据访问
语法: A[n]
操作类型: A为array类型,n为int类型
说明:返回数组A中的第n个变量值,数组的起始下标为0
select score, score[0], score[1] from demo_class ;
1
[90,92] 90 92
[80,60] 80 60
[50,66] 50 66
2.size()函数可以查询数组中元素的个数,下标超过长度返回null 值
[90,92] 2 NULL
[80,60] 2 NULL
[50,66] 2 NULL
select score, size(score), score[3] from demo_class ;
1
3.array_contains()函数可以查询数组中是否包含某个元素
array_contains(数组名,值)
返回 true 或 false
select score, array_contains(score, 90) from demo_class;
1
[90,92] true
[80,60] false
[50,66] false
map类型
1.数据访问
语法: M[key]
操作类型: M为map类型,key为map中的key值
说明:返回map类型M中key值为指定值的value值
select result, result['math'], result['english'] from demo_class ;
1
{“math”:90,“english”:92} 90 92
{“math”:80,“english”:60} 80 60
{“math”:50,“english”