Codewars SQL

SQL Basics: Simple FULL TEXT SEARCH

For this challenge you need to create a simple SELECT statement. Your task is to create a query and do a FULL TEXT SEARCH. You must search the product table on the field name for the word Awesome and return each row with the given word. Your query MUST contain to_tsvector and to_tsquery PostgreSQL functions.

Tables and relationship below:

Hint: PostgreSQL text-searching functions: https://www.postgresql.org/docs/12/functions-textsearch.html

Solution:

select * from product
where to_tsvector(name) @@ to_tsquery('Awesome');

Link

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Isabelle

Isabelle

In love with telling stories with data