Questions: UPDATE with JOINs: Conditional Updates

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A developer wants to sync prices from a staging table: UPDATE products SET price = price_updates.new_price FROM price_updates WHERE products.sku = price_updates.sku. What should they do before running this UPDATE?

ARun SELECT COUNT(*) FROM price_updates to ensure there are rows to update
BRun the equivalent SELECT showing which rows would be affected, to verify matches and spot any duplicate SKUs in the staging table
CRun EXPLAIN on the UPDATE to check query cost
DRun SELECT * FROM products to see current prices
Question 2 Multiple Choice

A developer familiar with MySQL writes an UPDATE-JOIN query and then runs it on a PostgreSQL server. The query fails with a syntax error. What is the most likely cause?

APostgreSQL does not support updating rows based on data in other tables
BPostgreSQL requires a FROM clause instead of writing the JOIN directly after UPDATE
CUPDATE-JOIN only works in MySQL because PostgreSQL uses triggers for this pattern
DThe table aliases used in MySQL syntax are not valid in PostgreSQL
Question 3 True / False

Using UPDATE with a JOIN to synchronize rows from a staging table is functionally equivalent to looping through rows one at a time and running individual UPDATE statements.

TTrue
FFalse
Question 4 True / False

When a JOIN in an UPDATE statement matches multiple rows in the joined table to a single row in the target table, the behavior is consistent and predictable across most major relational databases.

TTrue
FFalse
Question 5 Short Answer

Why is it valuable to run an UPDATE-JOIN query as a SELECT statement first, before executing the actual update?

Think about your answer, then reveal below.