測量兩個字串之間的相似度
現在你已啟用 fuzzystrmatch 和 pg_trgm 延伸套件,可以開始探索它們的功能。首先,我們要量測 Sakila 資料庫中 film 資料表的片名與描述之間的相似度。
本練習屬於課程
在 PostgreSQL 操作資料的函式
練習說明
- 選取電影的片名與描述。
- 計算片名與描述之間的相似度。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
-- Select the title and description columns
SELECT
___,
___,
-- Calculate the similarity
___(___, ___)
FROM
film