Bird
0
0

Which SQL command is used inside a PostgreSQL function returning SETOF to return each row?

easy📝 Conceptual Q2 of 15
PostgreSQL - Advanced PL/pgSQL

Which SQL command is used inside a PostgreSQL function returning SETOF to return each row?

ARETURN QUERY
BRETURN ROW
CRETURN NEXT
DRETURN ALL
Step-by-Step Solution
Solution:
  1. Step 1: Recall how to return rows one by one

    In a function returning SETOF, RETURN NEXT adds one row to the result set.
  2. Step 2: Check other options

    RETURN QUERY returns a whole query result, RETURN ROW and RETURN ALL are invalid commands.
  3. Final Answer:

    RETURN NEXT -> Option C
  4. Quick Check:

    RETURN NEXT adds one row in SETOF functions [OK]
Quick Trick: Use RETURN NEXT to add rows one at a time [OK]
Common Mistakes:
  • Using RETURN ROW which is not valid
  • Confusing RETURN NEXT with RETURN QUERY
  • Trying RETURN ALL which does not exist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes