17.05 - Rules for Using Correlated Subqueries in a DELETE Statement - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Advanced SQL Engine
Teradata Database
Release Number
Release Date
January 2021
Content Type
Programming Reference
Publication ID
English (United States)
The following rules apply to correlated subqueries used in a DELETE statement:
  • A DELETE statement requires that if joined tables are specified, all tables referenced in the DELETE statement must be specified in the FROM clause, including the deleted table.

    A table_name must be added to specify the deleted table name in this case.

  • All correlation names must be defined in the FROM clause.

    Correlation names are also referred to as range variables and aliases.

  • If a correlation name is defined for the deleted table name in the FROM clause, then that correlation name, not the original table name, must be used as the table_name that follows the DELETE keyword.
  • If an inner query column specification references an outer FROM clause table, then the column reference must be fully qualified.
  • The table_name preceding the FROM clause is optional if no joined tables are specified for deletion.

Also see Correlated Subqueries.