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

SQL Data Manipulation Language

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-05
dita:mapPath
pon1628111750298.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
esx1472246586715
lifecycle
latest
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.