UPDATE ... FROM
Update rows using data joined from another table.
update from update join update with join update from select
update join multi-table
| Database | Status | Syntax Family | Min Version |
|---|---|---|---|
| PostgreSQL | full | update-from | - |
| MySQL | full | update-join | - |
| MariaDB | full | update-join | - |
| Oracle | workaround | subquery | - |
| SQL Server | full | update-from | - |
| SQLite | full | update-from | 3.33.0 |
| Redshift | full | update-from | - |
| DB2 | partial | correlated-subquery | - |
| Snowflake | full | update-from | - |
| BigQuery | full | update-from | - |
Compare Databases
Database Details
PostgreSQL
full
UPDATE orders
SET status = 'shipped'
FROM customers
WHERE orders.customer_id = customers.id
AND customers.tier = 'premium';- Uses a FROM clause to join additional tables.
- Target table must not appear in FROM clause (it's implicit).
Docs: UPDATE
MySQL
full
UPDATE orders
JOIN customers ON orders.customer_id = customers.id
SET orders.status = 'shipped'
WHERE customers.tier = 'premium';- Uses multi-table UPDATE with JOIN syntax.
- SET clause comes after the JOIN.
Docs: UPDATE
MariaDB
full
UPDATE orders
JOIN customers ON orders.customer_id = customers.id
SET orders.status = 'shipped'
WHERE customers.tier = 'premium';- Same multi-table UPDATE syntax as MySQL.
Docs: UPDATE
Oracle
workaround
UPDATE orders
SET status = 'shipped'
WHERE customer_id IN (
SELECT id FROM customers WHERE tier = 'premium'
);- No direct UPDATE ... FROM or UPDATE ... JOIN syntax.
- Use correlated subqueries or MERGE for join-based updates.
Docs: UPDATE
SQL Server
full
UPDATE orders
SET status = 'shipped'
FROM orders
JOIN customers ON orders.customer_id = customers.id
WHERE customers.tier = 'premium';- Supports UPDATE ... FROM with JOIN.
- Target table appears both before SET and in FROM clause.
Docs: UPDATE
SQLite
full
UPDATE orders
SET status = 'shipped'
FROM customers
WHERE orders.customer_id = customers.id
AND customers.tier = 'premium';- Added in SQLite 3.33.0 (2020-08-14).
- Syntax similar to PostgreSQL.
Docs: UPDATE FROM
Redshift
full
UPDATE inventory
SET quantity = s.new_qty
FROM daily_updates s
WHERE inventory.product_id = s.product_id;- Identical to PostgreSQL syntax.
- UPDATE t SET col = s.val FROM source_table s WHERE t.id = s.id.
Docs: UPDATE
DB2
partial
UPDATE inventory t
SET quantity = (
SELECT new_qty FROM daily_updates s WHERE s.product_id = t.product_id
)
WHERE EXISTS (
SELECT 1 FROM daily_updates s WHERE s.product_id = t.product_id
);- DB2 does not support UPDATE...FROM syntax. Use a correlated subquery in the SET clause and WHERE.
- DB2 also supports MERGE for more complex update-from scenarios.
Docs: UPDATE
Snowflake
full
UPDATE inventory
SET quantity = s.new_qty
FROM daily_updates s
WHERE inventory.product_id = s.product_id;- Supports multi-table UPDATE syntax.
- UPDATE t SET col = s.val FROM source_table s WHERE t.id = s.id.
Docs: UPDATE
BigQuery
full
UPDATE inventory
SET quantity = s.new_qty
FROM daily_updates s
WHERE inventory.product_id = s.product_id;- UPDATE t SET col = s.val FROM source_table s WHERE t.id = s.id.
Docs: UPDATE statement