Check out example codes for "fetcht he leftmost word in a comma separated string in sql". It will help you in understanding the concepts better.

Code Example 1

SELECT SUBSTRING_INDEX(address, ',', 4) FROM employees;
+-----------+------------------------------------+
| name      | SUBSTRING_INDEX(address, ',', 4)   |
+-----------+------------------------------------+
| John Doe  | 4225 Collins Street,Apt. A,Erie,PA |
| Bob Smith | 234 Main Street,,Erie,PA           |
+-----------+------------------------------------+

Learn ReactJs, React Native from akashmittal.com