SQL searching table fields with LIKE
Posted
by
Tom Gullen
on Stack Overflow
See other posts from Stack Overflow
or by Tom Gullen
Published on 2011-03-03T15:22:58Z
Indexed on
2011/03/03
15:24 UTC
Read the original article
Hit count: 344
Given your data stored somewhere in a database:
Hello my name is Tom I like dinosaurs to talk about SQL. SQL is amazing. I really like SQL.
We want to implement a site search, allowing visitors to enter terms and return relating records. A user might search for:
Dinosaurs
And the SQL:
WHERE articleBody LIKE '%Dinosaurs%'
Copes fine with returning the correct set of records.
How would we cope however, if a user mispells dinosaurs? IE:
Dinosores
(Poor sore dino). How can we search allowing for error in spelling? We can associate common misspellings we see in search with the correct spelling, and then search on the original terms + corrected term, but this is time consuming to maintain.
Any way programatically?
© Stack Overflow or respective owner