Bird
0
0

Which of the following is the correct syntax to return all columns of updated rows in PostgreSQL?

easy📝 Syntax Q12 of 15
PostgreSQL - Set Operations and Advanced Queries
Which of the following is the correct syntax to return all columns of updated rows in PostgreSQL?
AUPDATE table_name SET col = val RETURNING ALL COLUMNS;
BUPDATE table_name SET col = val RETURNING *;
CUPDATE table_name SET col = val RETURNING ALL;
DUPDATE table_name SET col = val RETURN *;
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct RETURNING syntax

    PostgreSQL uses RETURNING followed by column names or * to return all columns.
  2. Step 2: Identify correct option

    Only UPDATE table_name SET col = val RETURNING *; uses RETURNING * which is valid syntax to return all columns.
  3. Final Answer:

    UPDATE table_name SET col = val RETURNING *; -> Option B
  4. Quick Check:

    RETURNING * returns all columns [OK]
Quick Trick: Use RETURNING * to get all columns after update [OK]
Common Mistakes:
  • Using RETURN instead of RETURNING
  • Writing RETURNING ALL instead of RETURNING *
  • Adding extra keywords like ALL COLUMNS

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes