Updating data in a table

You use the UPDATE statement to modify data already stored in a table. An example shows how to apply the syntax.

You construct an UPDATE statement using the following syntax:
UPDATE tablename SET column = value [, column = value ...] [WHERE expression];
            

Depending on the condition specified in the optional WHERE clause, an UPDATE statement might affect every row in a table. The expression in the WHERE clause must be an expression supported by a SELECT clause. Subqueries are not allowed on the right side of the SET clause. Partition columns cannot be updated.

Impala allows an optional FROM clause after the SET clause to restrict the updates to only the rows in the specified table that are part of the result set for a join query.

You must have SELECT and UPDATE privileges to use the UPDATE statement.

Create a statement that changes the values in the name column of all rows where the gpa column has the value of 1.0.
UPDATE students SET name = null WHERE gpa <= 1.0;