Bird
0
0

What is the primary advantage of using a PostgreSQL function with RETURNS TABLE compared to returning a single scalar value?

easy📝 Conceptual Q1 of 15
PostgreSQL - Advanced PL/pgSQL
What is the primary advantage of using a PostgreSQL function with RETURNS TABLE compared to returning a single scalar value?
AIt allows returning multiple rows and columns as a result set.
BIt improves the function execution speed significantly.
CIt automatically creates indexes on the returned data.
DIt restricts the function to return only one row.
Step-by-Step Solution
Solution:
  1. Step 1: Understand RETURNS TABLE

    Functions declared with RETURNS TABLE return a set of rows with defined columns.
  2. Step 2: Compare with scalar returns

    Scalar functions return a single value, while RETURNS TABLE returns multiple rows and columns.
  3. Final Answer:

    It allows returning multiple rows and columns as a result set. -> Option A
  4. Quick Check:

    RETURNS TABLE returns sets, not single values. [OK]
Quick Trick: RETURNS TABLE returns multiple rows and columns [OK]
Common Mistakes:
  • Thinking RETURNS TABLE returns only one row
  • Assuming RETURNS TABLE improves speed automatically
  • Confusing RETURNS TABLE with index creation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes