Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register


1
(click on this box to dismiss)

What SQL statement can I use for contains?

I want to select all the rows that contain a substring, how can I do this fast? I have an index on the column that I'm testing.

link comment (0)
asked 3 years ago
sqlcopter
284
9 Answers
0

How about using LOCATE or POSITION functions?

SELECT * from my_table
WHERE LOCATE('phrase', title) > 0;

0 is returned if the title column does not contain the phrase.

I should also mention that these functions are case-sensitive. See the manual for more information http://www.cubrid.org/manual/840/en/LOCATE%20Function.

link comment (0)
answered 3 years ago
dba
558
tagged




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: