What is the key difference between a correlated UPDATE using a subquery and a UPDATE … FROM join in SQL Server/PostgreSQL?

Advanced SQL Developer Hard

Advanced SQL Developer — Hard

What is the key difference between a correlated UPDATE using a subquery and a UPDATE … FROM join in SQL Server/PostgreSQL?

Key points

  • Correlated UPDATE subquery updates each target row exactly once
  • UPDATE ... FROM can update a row multiple times if source has multiple matching rows
  • Non-deterministic results can occur with UPDATE ... FROM
  • Correlated subqueries provide deterministic results

Ready to go further?

Related questions