Bird
0
0

What is the result of this query?

medium📝 query result Q5 of 15
PostgreSQL - Set Operations and Advanced Queries
What is the result of this query?
SELECT letter FROM (VALUES ('A'), ('B'), ('C')) AS t(letter) WHERE letter = 'B';
AA
BB
CC
DNo rows
Step-by-Step Solution
Solution:
  1. Step 1: Identify the inline data and alias

    The VALUES clause creates rows with letters 'A', 'B', and 'C' aliased as letter.
  2. Step 2: Apply the WHERE condition letter = 'B'

    Only the row with letter 'B' matches and is returned.
  3. Final Answer:

    B -> Option B
  4. Quick Check:

    WHERE letter = 'B' returns B only [OK]
Quick Trick: Filter inline rows by column alias in WHERE [OK]
Common Mistakes:
  • Returning all letters ignoring WHERE
  • Returning no rows by mistake

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes