更新<一個class="headerlink" href="//www.eheci.com/docs/spark/latest/spark-sql/language-manual/#update" title="">

適用於:檢查標記是的磚的SQL檢查標記是的磚運行時

更新的列值行匹配謂詞。當沒有提供謂詞,更新的列值的行。

這種說法隻支持三角洲湖表。

語法<一個class="headerlink" href="//www.eheci.com/docs/spark/latest/spark-sql/language-manual/#syntax" title="">

更新table_name(table_alias]{{column_name|field_name}=(expr|默認的}(,](在哪裏條款]

參數<一個class="headerlink" href="//www.eheci.com/docs/spark/latest/spark-sql/language-manual/#parameters" title="">

  • table_name

    標識表更新。表名不能使用<一個class="reference internal" href="//www.eheci.com/docs/docs/spark/latest/spark-sql/language-manual/sql-ref-names.html">時間規範

  • table_alias

    為表定義一個別名。別名必須不包括列清單。

  • column_name

    引用表中的一列。你可以參考每一列最多一次。

  • field_name

    引用字段在一個結構體類型的列。你可以參考每個字段最多一次。

  • expr

    一個任意的表達式。如果你參考table_name列代表行之前的狀態更新。

  • 默認的

    適用於:檢查標記是的磚的SQL<一個class="reference internal" href="//www.eheci.com/docs/docs/spark/latest/spark-sql/release-notes/index.html">SQL倉庫2022.35版本或更高版本檢查標記是的磚運行時11.2及以上

    默認的列的表達式如果一個定義,否則空。

  • 在哪裏

    通過謂詞過濾行。的在哪裏條款可能包括子查詢以下異常:

    • 內嵌套的子查詢,子查詢另一個查詢

    • 一個子查詢在一個例如,一個=3b(選擇ct)

    在大多數情況下,您可以重寫子查詢使用存在。你應該使用存在隻要有可能,如更新子查詢可以緩慢。

例子<一個class="headerlink" href="//www.eheci.com/docs/spark/latest/spark-sql/language-manual/#examples" title="">

>更新事件eventType=“點擊”在哪裏eventType=“時鍾”>更新all_eventssession_time=0,忽略了=真正的在哪裏session_time<(選擇最小值(session_time)good_events)>更新訂單作為t1order_status=“返回”在哪裏存在(選擇oidreturned_orders在哪裏t1oid=oid)>更新事件類別=“定義”在哪裏類別(選擇類別events2在哪裏日期>“2001-01-01”)>更新事件忽略了=默認的在哪裏eventType=“未知”