What does LIKE'%aa%'
exactly do?
Is it case-sensitive?
Asked
Active
Viewed 1,445 times
-7
-
6I assume you've already consulted the documentation. What aspect(s) are unclear to you? – Damien_The_Unbeliever May 31 '17 at 10:49
-
1it looks for a string that has two consecutive "aa" in it and returns the string – divine May 31 '17 at 10:49
-
1`col like '%aa%'` finds any string that has "aa" anywhere inside it. – Gordon Linoff May 31 '17 at 10:49
-
Find value it having "a" anywhere in respective column – Shoaib Quraishi May 31 '17 at 10:51
-
is 'aa' case sensitive ? – Upasana Roy May 31 '17 at 10:56
-
you have to check the collation. https://stackoverflow.com/questions/14962419/is-the-like-operator-case-sensitive-with-ms-sql-server. Other wise you have convert on both sides – Nayas Subramanian May 31 '17 at 10:59
-
try this https://www.w3schools.com/sql/sql_wildcards.asp – Krunal Limbad May 31 '17 at 11:01
-
1@UpasanaRoy it is case in-sensitive . ignore the negative votes. it is a good question :) . From next time frame the question properly. – divine May 31 '17 at 11:07
4 Answers
2
The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.
e.g. WHERE CustomerName LIKE '%aa%'
Finds any values that have "aa" in any position

Bahadur Singh Deol
- 753
- 2
- 6
- 17
1
in a where clause it looks for anything which would contain 'aa'.
% acts a wildcard so anything can be before it or after it

dbajtr
- 2,024
- 2
- 14
- 22
1
It search for a record in which the field in the condition contains the literal, in this case 'aa'
.
For instance:
Select * from Employee
where Name like '%aa%'
It retrieves all employees where the names contains the literal 'aa'
..
Regards!!!

Dadep
- 2,796
- 5
- 27
- 40

Pablo Aguilar
- 26
- 2