<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to update the items in array of struct column with sql in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-update-the-items-in-array-of-struct-column-with-sql/m-p/2927#M160</link>
    <description>&lt;P&gt;Hi @Richard Guo​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great to meet you, and thanks for your question! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's see if your peers in the community have an answer to your question. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 17 Jun 2023 09:29:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-06-17T09:29:43Z</dc:date>
    <item>
      <title>How to update the items in array of struct column with sql</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-update-the-items-in-array-of-struct-column-with-sql/m-p/2926#M159</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;create table test.json_test_01 (
	id int,
	description string,
	struct_address STRUCT&amp;lt;street_number: STRING, street_name: STRING, city: STRING, province: STRING&amp;gt;,
	arrary_phone ARRAY&amp;lt;STRUCT&amp;lt;phone_number: STRING, phone_type: STRING&amp;gt;&amp;gt;
);
&amp;nbsp;
insert into test.json_test_01
select 1 as id,
       'first' as description,
       STRUCT('1001', 'street1', 'city1', 'province1') as struct_address,
       ARRAY(STRUCT('1000001', 'Home'), STRUCT('1000002', 'Cell'));
&amp;nbsp;
insert into test.json_test_01
select 2 as id,
       'second' as description,
       STRUCT('2001', 'street2', 'city2', 'province2') as struct_address,
       ARRAY(STRUCT('2000001', 'Home'), STRUCT('2000002', 'Work'));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;we can update the property in struct column:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;update test.json_test_01
set struct_address.street_number = '3001'
where id = 1;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but how to update the property in array of struct?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;update test.json_test_01
set arrary_phone[*].phone_type = 'X'
where id = 2;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 21:27:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-update-the-items-in-array-of-struct-column-with-sql/m-p/2926#M159</guid>
      <dc:creator>guostong</dc:creator>
      <dc:date>2023-06-16T21:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to update the items in array of struct column with sql</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-update-the-items-in-array-of-struct-column-with-sql/m-p/2927#M160</link>
      <description>&lt;P&gt;Hi @Richard Guo​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great to meet you, and thanks for your question! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's see if your peers in the community have an answer to your question. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jun 2023 09:29:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-update-the-items-in-array-of-struct-column-with-sql/m-p/2927#M160</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-17T09:29:43Z</dc:date>
    </item>
  </channel>
</rss>

