웹이야기

[MySQL] INSTR() 본문

D/MySQL

[MySQL] INSTR()

yeon.Biju 2020. 4. 13. 11:39

MySQL 문자열 함수와 연산자

 

INSTR()

   - 

 

INSTR(str, substr)

의 형태

 

Returns the position of the first occurence of sustring substr in string str. This is the same as the two-argument form of LOCATE(), except that the order of the arguments is reversed. 

 

This function is multibyte safe, and is case-sensitive only if at least one argument is a binary string.

 

mysql> SELECT INSTR('foobarbar', 'bar') ;
+---------------------------+
| INSTR('foobarbar', 'bar') |
+---------------------------+
|                         4 |
+---------------------------+
1 row in set (0.00 sec)

 


mysql> SELECT INSTR('xbar', 'foobar') ;
+-------------------------+
| INSTR('xbar', 'foobar') |
+-------------------------+
|                       0 |
+-------------------------+
1 row in set (0.00 sec)

 

mysql> SELECT INSTR('한글', '한') ;
+------------------------+
| INSTR('한글', '한')    |
+------------------------+
|                      1 |
+------------------------+
1 row in set (0.00 sec)

 

 

'D > MySQL' 카테고리의 다른 글

[MySQL] LEFT()  (0) 2020.04.14
[MySQL] LCASE()  (0) 2020.04.13
[MySQL] INSERT()  (0) 2020.04.13
[MySQL] HEX()  (0) 2020.04.13
MySQL FROM_BASE64()  (0) 2020.04.13
Comments