Teradata UPDATE Statement

Teradata UPDATE statement update columns of an existing table in Teradata. You can update one or more columns using a single UPDATE statement.

Teradata UPDATE Statement syntax

The general syntax for the Teradata UPDATE statement is as follows.

 To update all the records in a column

UPDATE DatabaseName.TableName
SET column_name = value;

To update specific records in column

UPDATE DatabaseName.TableName
SET column_name = value
WHERE condition;

To update multiple columns in a table

UPDATE DatabaseName.TableName
SET column1 = value1,
column2 = value2,
...
columnN = valueN
WHERE condition;

Teradata UPDATE Statement example

Consider the following employee table.

empno ename dob job mgr hiredate sal deptno
1 SMITH 24-02-1988 CLERK 7902 13-06-2016 800 20
2 JONES 10-07-1988 SALESMAN 7698 18-05-2018 1600 30
3 BLAKE 25-10-1990 SALESMAN 7698 26-03-2016 1250 30
4 CLARK 23-09-1991 MANAGER 7839 31-10-2015 2975 20
5 SCOTT 12-01-1992 MANAGER 7839 11-06-2016 2850 10
6 KING 05-08-1988 ANALYST 7839 14-05-2017 2450 10
7 TURNER 17-09-1988 PRESIDENT 7566 05-05-2017 3000 20

The below statement updates mgr columns for all the employees.

UPDATE Teradatapoint.tbl_employee
SET mgr=7902;

When the above query is executed it returns the following records.

teradata update statement

The below example updates mgr for the employee whose empno is 6.

UPDATE Teradatapoint.tbl_employee
SET mgr=7902
WHERE empno=6;

And the below SQL statement updates both the mgr and job column.

UPDATE Teradatapoint.tbl_employee
SET mgr=7902,
job='Sr. Manager'
WHERE empno=6;

Leave a Comment