I have a table looks like below: 

```
ID                  path                      
| 1               YouTube,Newsletter,Social  
| 2               YouTube,Newsletter         
| 3               YouTube                    

```

Now I want to create a column to count the length of the path column. such as below: 

```
ID                  path                      count    weights              
| 1               YouTube,Newsletter,Social     3        0.33
| 2               YouTube,Newsletter            2        0.5
| 3               YouTube                       1         1

```

How do I do this? 

I have tried JSON\_LENGTH but couldn't get the command working.

PS. essentially I'm trying to replicate a query in PostgreSQL: 
' select user\_id, channels, 1.0 / array\_length(channels, 1) as weights 
 from (
 // ... query for marketing\_channels as before)'
I am using MYSQL. 

```
select d.email_entry_id
      ,d.channels 
      ,JSON_LENGTH(d.channels) 
from (   
  select email_entry_id
       ,group_concat(attribution_string order by visit_date asc separator ',' ) as channels
  from database) d 

```

error message: Error Code: 1370. execute command denied to user 'yb'@'%' for routine 'company.JSON\_LENGTH'

Hope the question is clear enough. let me know if i need to clarify anything.