SUBSTRING Function - How to use SUBSTRING Function in MySQL

SUBSTRING Function - How to use SUBSTRING Function in MySQL


SUBSTRING Function in MySQL is used to extract a substring from a position with specific position.

Syntax:


SUBSTRING(string,position);
SUBSTRING(string,position,length);



So in below example if we want to start from 3rd characters and returned the rest of rows we can do that. In second part of select we are specificity telling start from 4th characters but only returned 4 records from 4th position.


Select substring('My Test string',3),
substring('My Test string',4,4) from customer;


How to use SUBSTRING Function in MySQL - MySQL Tutorial

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.