SQL practice: Full-Text Search: Beyond LIKE
Chapter 41 · 7 questions · included in full access
Question 1 · easy
Solve it in your browserConvert the text 'South Facade Works' into a tsvector using the english configuration, in a column named doc.
Question 2 · easy
Solve it in your browserList the customer_name of every customer whose name matches the search term 'facade', using to_tsvector and to_tsquery. Order by customer_name.
Question 3 · medium
Solve it in your browserFind customers matching both 'panel' and 'house', using plainto_tsquery so the words can be passed in as a plain phrase. Show customer_name, ordered by customer_name.
Question 4 · medium
Solve it in your browserUse websearch_to_tsquery to find customers matching the phrase "facade works", quoted so the words must be adjacent. Show customer_name, ordered by customer_name.
Question 5 · medium
Solve it in your browserRank customers against the query 'facade' and show customer_name with the score in a column named rank, best first, then by name.
Question 6 · hard
Solve it in your browserFind every product whose name matches 'sheet' but not 'silver', using to_tsquery with the & and ! operators. Show product_name, ordered by product_name.
Question 7 · hard
Solve it in your browserYou add a GIN index on to_tsvector(customer_name) but your queries use to_tsvector('english', customer_name). Why is the index never used?
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing