Rules for Using Correlated Subqueries in a DELETE Statement - Teradata Database - Teradata Vantage NewSQL Engine

SQL Data Manipulation Language

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
fbo1512081269404.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™
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.