Bird
0
0

What will be the output of this query?

medium📝 query result Q5 of 15
PostgreSQL - Full-Text Search
What will be the output of this query?
SELECT to_tsquery('!apple | banana');
AError: invalid syntax
B'apple' & 'banana'
C'!apple' | 'banana'
D'!apple & banana'
Step-by-Step Solution
Solution:
  1. Step 1: Parse the input string

    The input uses NOT (!) on 'apple' and OR (|) with 'banana'.
  2. Step 2: Understand to_tsquery output

    The output preserves the NOT and OR operators as '!apple' | 'banana'.
  3. Final Answer:

    '!apple' | 'banana' -> Option C
  4. Quick Check:

    NOT and OR operators preserved [OK]
Quick Trick: Use ! for NOT and | for OR in to_tsquery [OK]
Common Mistakes:
  • Mixing AND and OR operators
  • Expecting syntax error
  • Misplacing NOT operator

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes