Tuesday, 2 August 2016

SUBSTR(): Get the substring



SUBSTR(string, offset, noOfCharsToExtract): Return the part of a string.

mysql> SELECT SUBSTR("HELLO HARI, HOW ARE YOU", 1, 5);
+-----------------------------------------+
| SUBSTR("HELLO HARI, HOW ARE YOU", 1, 5) |
+-----------------------------------------+
| HELLO                                   |
+-----------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT SUBSTR("HELLO HARI, HOW ARE YOU", 7, 4);
+-----------------------------------------+
| SUBSTR("HELLO HARI, HOW ARE YOU", 7, 4) |
+-----------------------------------------+
| HARI                                    |
+-----------------------------------------+
1 row in set (0.00 sec)



Previous                                                 Next                                                 Home

No comments:

Post a Comment