Multi-Table UPDATE / DELETE
Update or delete rows in one table based on a join condition with another table.
multi-table delete delete join delete using multi-table update
update delete join multi-table
| Database | Status | Syntax Family | Min Version |
|---|---|---|---|
| PostgreSQL | full | delete-using | - |
| MySQL | full | multi-table-delete | - |
| MariaDB | full | multi-table-delete | - |
| Oracle | workaround | subquery | - |
| SQL Server | full | delete-from-join | - |
| SQLite | workaround | subquery | - |
| Redshift | full | delete-using+update-from | - |
| DB2 | partial | correlated-subquery | - |
| Snowflake | full | delete-using+update-from | - |
| BigQuery | partial | update-from+delete-subquery | - |
Compare Databases
Database Details
PostgreSQL
full
DELETE FROM orders
USING customers
WHERE orders.customer_id = customers.id
AND customers.status = 'inactive';- Uses DELETE ... USING to join additional tables.
- Only deletes from the target table, not from the USING tables.
Docs: DELETE
MySQL
full
DELETE orders
FROM orders
JOIN customers ON orders.customer_id = customers.id
WHERE customers.status = 'inactive';- Can delete from multiple tables in a single statement.
- Specify which tables to delete from before the FROM clause.
Docs: DELETE
MariaDB
full
DELETE orders
FROM orders
JOIN customers ON orders.customer_id = customers.id
WHERE customers.status = 'inactive';- Same multi-table DELETE syntax as MySQL.
Docs: DELETE
Oracle
workaround
DELETE FROM orders
WHERE customer_id IN (
SELECT id FROM customers WHERE status = 'inactive'
);- No multi-table DELETE or DELETE ... USING syntax.
- Use correlated subqueries or EXISTS clauses.
Docs: DELETE
SQL Server
full
DELETE orders
FROM orders
JOIN customers ON orders.customer_id = customers.id
WHERE customers.status = 'inactive';- Uses DELETE ... FROM with JOIN.
- Only the target table rows are deleted.
Docs: DELETE
SQLite
workaround
DELETE FROM orders
WHERE customer_id IN (
SELECT id FROM customers WHERE status = 'inactive'
);- No multi-table DELETE syntax.
- Use subqueries in the WHERE clause.
Docs: DELETE
Redshift
full
DELETE FROM orders
USING customers
WHERE orders.customer_id = customers.id
AND customers.status = 'inactive';- Supports joined UPDATE via UPDATE ... FROM and joined DELETE via DELETE ... USING.
- Like PostgreSQL, only the target table is modified; joined tables are used for filtering.
DB2
partial
DELETE FROM orders o
WHERE EXISTS (
SELECT 1
FROM customers c
WHERE c.id = o.customer_id
AND c.status = 'inactive'
);- Db2 does not use PostgreSQL-style DELETE ... USING or MySQL-style multi-table DELETE syntax.
- Equivalent behavior is achieved with correlated subqueries or MERGE.
Snowflake
full
DELETE FROM orders
USING customers
WHERE orders.customer_id = customers.id
AND customers.status = 'inactive';- Supports joined UPDATE via UPDATE ... FROM and joined DELETE via DELETE ... USING.
- Only the target table is modified; joined tables participate in the predicate.
BigQuery
partial
UPDATE orders
SET status = 'archived'
FROM customers
WHERE orders.customer_id = customers.id
AND customers.status = 'inactive';- Supports joined UPDATE via UPDATE ... FROM.
- DELETE does not use PostgreSQL-style USING syntax; equivalent delete behavior typically uses a subquery or MERGE.
Docs: BigQuery DML syntax