| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
- 방화벽
- Tibero
- 티베로
- Oracle
- SVN
- Sring Functions and Operators
- MySQL
- String Function and Operators
- String Functions and Operators
- 전자정부표준프레임워크
- 윈도우
- 오라클
- Data and Time Functions
- HTTP
- 전자정부 표준프레임워크
- String Functions and Date Operators
- Date and Time Functions
- Date and Time Function
- Today
- Total
웹이야기
[MySQL]SUBSTRING_INDEX() 본문
MySQL 문자열 함수와 연산자
SUBSTRING_INDEX()
-
SUBSTRING_INDEX(str, delim, count)
의 형태
Returns the substring from strikng str before count occurences of the delimiter delim. If count is positive, everything to the left of the final delimiter(counting from the left) is returned. If count is negative, everything to the right of the final delimter(counting from the right) is returned.
SUBSTRING_INDEX() performs a case-sensitive match when searching for delim.
mysql> SELECT SUBSTRING_INDEX('www.mysql.com','.', 2);
+-----------------------------------------+
| SUBSTRING_INDEX('www.mysql.com','.', 2) |
+-----------------------------------------+
| www.mysql |
+-----------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT SUBSTRING_INDEX('www.mysql.com','.', -2);
+------------------------------------------+
| SUBSTRING_INDEX('www.mysql.com','.', -2) |
+------------------------------------------+
| mysql.com |
+------------------------------------------+
1 row in set (0.00 sec)
'D > MySQL' 카테고리의 다른 글
| [MySQL]UCASE() (0) | 2020.06.18 |
|---|---|
| [MySQL]TRIM() (0) | 2020.06.18 |
| [MySQL]SUBSTR() (0) | 2020.06.11 |
| [MySQL]SPACE() (0) | 2020.06.11 |
| [MySQL] RTRIM() (0) | 2020.04.20 |