16.20 - UPDATE - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Manipulation Language

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
created_date
March 2019
category
Programming Reference
featnum
B035-1146-162K

Purpose

Modifies column values in existing rows of a table.

The UPDATE statement can take the following forms:
  • Basic - updates one or more rows from a table.

    The Basic form can be specified with or without a FROM clause.

  • Basic for Joined Tables

    The Join Condition form updates rows from a table when the WHERE condition directly references columns in tables other than the one from which rows are to be updated; that is, if the WHERE condition includes a subquery or references a derived table.

  • Positioned - see “UPDATE (Positioned Form)” in Teradata Vantage™ SQL Stored Procedures and Embedded SQL , B035-1148 .
  • Temporal - see Teradata Vantage™ ANSI Temporal Table Support , B035-1186 and Teradata Vantage™ Temporal Table Support , B035-1182 .
  • Upsert - see UPDATE (Upsert Form).
See also:
  • INSERT/INSERT … SELECT
  • MERGE
  • “UPDATE (Positioned Form)” in Teradata Vantage™ SQL Stored Procedures and Embedded SQL , B035-1148
  • UPDATE (Upsert Form)
  • Teradata Vantage™ ANSI Temporal Table Support , B035-1186
  • Teradata Vantage™ Temporal Table Support , B035-1182

Required Privileges

The following privilege rules apply to the UPDATE statement:
  • You must have the UPDATE privilege on the table or columns to be updated.
  • To update any UDT column, you must also have the UDTUSAGE privilege on that column.
  • When executing an UPDATE that also requires READ access to an object, you must have the SELECT privilege on the data being accessed.

For example, in the following request, READ access is required by the WHERE condition.

     UPDATE table_1
     SET column_1 = 1
     WHERE column_1 < 0;

Similarly, the following request requires READ access because you must read column_1 values from table_1 in order to compute the new values for column_1.

     UPDATE table_1
     SET field_1 = column_1 + 1;

The following request does not require SELECT privileges:

     UPDATE table_1
     SET column_3 = 0 ALL;

Syntax - Basic Form, No FROM Clause





Syntax - Basic Form, FROM Clause





Syntax - Joined Tables Form