Bird
0
0

Given the query:

medium📝 query result Q4 of 15
PostgreSQL - Full-Text Search
Given the query:
SELECT to_tsvector('english', 'The quick brown fox') @@ to_tsquery('english', 'quick & fox');
What is the output?
Atrue
Bfalse
CSyntax error
DNULL
Step-by-Step Solution
Solution:
  1. Step 1: Understand the to_tsvector and to_tsquery inputs

    The to_tsvector converts the text 'The quick brown fox' into searchable tokens. The to_tsquery creates a query for 'quick' AND 'fox'.

  2. Step 2: Evaluate the match using @@ operator

    Both 'quick' and 'fox' appear in the tsvector, so the match returns true.

  3. Final Answer:

    true -> Option A
  4. Quick Check:

    tsvector matches tsquery = true [OK]
Quick Trick: Both words must appear for & operator to return true [OK]
Common Mistakes:
  • Expecting false because of stop words
  • Confusing syntax causing errors
  • Assuming NULL for no match

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes