Full text search

From SQLZOO
Jump to navigation Jump to search

Full text search with SQL? such as i want to find a specific word in any colum of the table

schema:gisq

The "brute force" method is to use use the LIKE operator against any of the fields to be searched. This will be relatively expensive - but probably good enough in many cases. The term to search for should be quoted and placed within two wild cards.

You should construct the string literal in some scripting language - don't forget to quote it.

SELECT name FROM bbc
WHERE lower(name) LIKE '%the%'
SELECT name FROM bbc
WHERE name LIKE '%the%'
SELECT name FROM bbc
WHERE name LIKE '%the%'
SELECT name FROM bbc
WHERE name LIKE '%the%'
SELECT name FROM bbc
WHERE name LIKE '%the%'
DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects