Bird
0
0

Find the error in this query:

medium📝 Debug Q7 of 15
PostgreSQL - Advanced Features
Find the error in this query:
SELECT info.city FROM users;
Given that info is a composite type column with fields city and zip.
AField city does not exist in composite type
BQuery missing WHERE clause
CComposite types cannot be queried directly
DMissing parentheses around composite column when accessing field
Step-by-Step Solution
Solution:
  1. Step 1: Recall syntax for accessing composite fields

    Must use parentheses: (info).city to access field city.
  2. Step 2: Identify syntax error

    info.city without parentheses causes syntax error.
  3. Final Answer:

    Missing parentheses around composite column when accessing field -> Option D
  4. Quick Check:

    Access composite fields with (column).field [OK]
Quick Trick: Always use parentheses when accessing composite fields [OK]
Common Mistakes:
  • Omitting parentheses around composite column
  • Assuming composite fields are separate columns
  • Expecting query to work without WHERE clause

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes