Here is one of the methods I've experimented with (although not very effective):
select search, replace(filtered, 'butterflies', '') as filtered from ( select search, replace(filtered, 'of', '') as filtered from ( select search, replace(search, 'america', '') as filtered from table_name a ) b ) c;
This query will give you something like the following:
+---------------------+----------+ | search | filtered | +---------------------+----------+ | butterflies | | | america | | | birds of america | birds | | america butterflies | | +---------------------+----------+
The last part of this work gave me some problem, though ... you need a where clause that will return all lines that are "empty" (that is, contain only whitespace characters).
This will filter out the third row and return the desired result. However, I could not get this to work using trim (), and I don't know why.
For example, I tried:
where length(trim(c.filtered)) = 0;
This did not give me the result set that I wanted. I no longer have time to study this right now, but I wanted to mention this approach if someone else wants to call back and complete the puzzle. If not, I will try to study this a bit later today or tomorrow.
source share