Bird
0
0

Which of the following is the correct syntax to return all columns of deleted rows from a table named orders?

easy📝 Syntax Q3 of 15
PostgreSQL - Set Operations and Advanced Queries
Which of the following is the correct syntax to return all columns of deleted rows from a table named orders?
ADELETE FROM orders WHERE RETURNING *;
BDELETE FROM orders RETURNING *;
CDELETE RETURNING * FROM orders;
DDELETE FROM orders * RETURNING;
Step-by-Step Solution
Solution:
  1. Step 1: Recall DELETE statement syntax with RETURNING

    The RETURNING clause comes immediately after the DELETE statement and optional WHERE clause.
  2. Step 2: Validate DELETE FROM orders RETURNING *;

    DELETE FROM orders RETURNING *; correctly uses DELETE FROM orders RETURNING *; which returns all columns of deleted rows.
  3. Final Answer:

    DELETE FROM orders RETURNING *; -> Option B
  4. Quick Check:

    DELETE RETURNING syntax = DELETE FROM table RETURNING * [OK]
Quick Trick: Use RETURNING * after DELETE FROM to get deleted rows [OK]
Common Mistakes:
  • Placing RETURNING before FROM
  • Using RETURNING inside WHERE clause
  • Omitting FROM keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes