Bird
0
0

Given the table articles with a column content containing 'PostgreSQL is a powerful database system.', what is the output of this query?

medium📝 query result Q13 of 15
PostgreSQL - Full-Text Search
Given the table articles with a column content containing 'PostgreSQL is a powerful database system.', what is the output of this query?
SELECT ts_headline(content, 'database') FROM articles;
APostgreSQL is a powerful <em>database</em> system.
BPostgreSQL is a powerful database system.
CPostgreSQL is a powerful <b>database</b> system.
DError: ts_headline requires a tsquery type
Step-by-Step Solution
Solution:
  1. Step 1: Understand ts_headline output

    By default, ts_headline highlights matched words with tags.
  2. Step 2: Analyze the query and text

    The word 'database' matches the query 'database', so it will be wrapped in tags.
  3. Final Answer:

    PostgreSQL is a powerful database system. -> Option C
  4. Quick Check:

    Highlight uses tags = A [OK]
Quick Trick: Matched words get tags by default in ts_headline [OK]
Common Mistakes:
  • Expecting no tags or different tags like
  • Thinking ts_headline returns plain text without highlights
  • Assuming ts_headline needs explicit tsquery always

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes