Teradata Delete statement deletes the records from a table. You can delete either all the records or some specific records from an existing table using the delete statement.
Teradata Delete Statement syntax
The syntax for the Teradata Delete statement is as below.
The syntax for deleting all the records
DELETE FROM DatabaseName.TableName;
The syntax for deleting specific records
DELETE FROM DatabaseName.TableName WHERE condition;
Teradata Delete 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 SQL statement deletes all the records from the employee table.
DELETE FROM Teradatapoint.tbl_employee;
You can use the select statement to check if all the records are deleted.
The below statement deletes only the employee record whose empno
is 5.
DELETE FROM Teradatapoint.tbl_employee where empno=5;