Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sql searching multiple words in a string

Tags:

sql

What is the most efficient and elegant SQL query looking for a string containing the words "David", "Moses" and "Robi". Assume the table is named T and the column C.

like image 368
user181218 Avatar asked Jun 28 '11 12:06

user181218


People also ask

How check multiple strings in SQL?

Answers. Finally "Select * from @searchResult" will give the details of the search result for multiple string.

How do you search for a word in SQL in a sentence?

SQL Server CHARINDEX() Function The CHARINDEX() function searches for a substring in a string, and returns the position. If the substring is not found, this function returns 0. Note: This function performs a case-insensitive search.

Can we use like operator for multiple values in SQL?

“The SQL LIKE operator allows performing logical evaluation for any matching records. Using the LIKE operator, you can specify single or multiple conditions. This allows you to perform an action such as select, delete, and updating any columns or records that match the specified conditions.


1 Answers

Select * from table where    columnname like'%David%' and    columnname like '%Moses%' and columnname like'%Robi%'  
like image 116
Pranay Rana Avatar answered Oct 14 '22 00:10

Pranay Rana