MulaiMulai sekarang secara gratis

Basic full-text search

Searching text will become something you do repeatedly when building applications or exploring data sets for data science. Full-text search is helpful when performing exploratory data analysis for a natural language processing model or building a search feature into your application.

In this exercise, you will practice searching a text column and match it against a string. The search will return the same result as a query that uses the LIKE operator with the % wildcard at the beginning and end of the string, but will perform much better and provide you with a foundation for more advanced full-text search queries. Let's dive in.

Latihan ini adalah bagian dari kursus

Functions for Manipulating Data in PostgreSQL

Lihat Kursus

Petunjuk latihan

  • Select the title and description columns from the film table.
  • Perform a full-text search on the title column for the word elf.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

-- Select the title and description
SELECT ___, ___
FROM film
-- Convert the title to a tsvector and match it against the tsquery 
WHERE ____(___) ___ ___(___);
Edit dan Jalankan Kode