Bird
0
0

What will be the output of:

medium📝 query result Q5 of 15
PostgreSQL - Full-Text Search
What will be the output of:
SELECT ts_headline('english', 'Fast and reliable PostgreSQL', to_tsquery('english', 'fast & postgresql'));
A'<b>Fast</b> and reliable PostgreSQL'
B'Fast and reliable PostgreSQL'
C'Fast and reliable <b>PostgreSQL</b>'
D'<b>Fast</b> and reliable <b>PostgreSQL</b>'
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the tsquery expression

    The query looks for both 'fast' and 'postgresql' words.
  2. Step 2: Determine which words get highlighted

    Both 'Fast' and 'PostgreSQL' match and are highlighted.
  3. Final Answer:

    'Fast and reliable PostgreSQL' -> Option D
  4. Quick Check:

    Multiple matches highlighted correctly [OK]
Quick Trick: Use & to highlight multiple words [OK]
Common Mistakes:
  • Highlighting only one word
  • No highlighting due to wrong query
  • Highlighting unrelated words

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes