- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I use SUBSTRING_INDEX() function to get the substring as output which is between two same delimiters in a string?
We need to use nested SUBSTRING_INDEX() function for getting the substring as output which is between two same delimiters in a string. For example, from the string ‘www.tutorialspoint.com’, we want the substring ‘tutorialspoint’, which is in between two same delimiters ‘.’ as output then SUBSTRING_INDEX() function can be used in nested form as follows −
mysql> Select SUBSTRING_INDEX(SUBSTRING_INDEX('www.tutorialspoint.com','.',2),'.',-1)AS 'Nested SUBSTRING_INDEX'; +------------------------+ | Nested SUBSTRING_INDEX | +------------------------+ | tutorialspoint | +------------------------+ 1 row in set (0.02 sec)
Advertisements