Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am looking for an easy way to update values inside array of structs using SQL. Let's say we have a table:

CREATE TABLE schema.table
(
    date DATE,
    weights ARRAY<STRUCT<animal STRING, value FLOAT64>>
)
;

insert into schema.table
select cast('2020-01-01' as date), [('dog', 10.2), ('bird', 0.7), ('dragon', 3.2)]
union all
select cast('2020-01-02' as date), [('dog', 10.3), ('bird', 0.7)]
union all
select cast('2020-01-03' as date), [('dragon', 3.3)]

So the table looks like:

enter image description here

I would somehow like to update this table and change all dragon names to a cat.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
453 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...