MYSQL在逗号后选择一个值

Pretty new to mysql, I have a text column. There are two possible input scenarios for values:

TIME
hour, second

or

NAME
second

How do I check if the value has the first format (both hour and second separated by a comma), and if so, select the 'second' only?

A hint:

select if(locate(',', yourcolumn) > 0, right(yourcolumn, (length(yourcolumn) - locate(',', yourcolumn))), yourcolumn)
//Assume that you have two formats only for your input like :

$input = '6, 30';

//or 

$input = '30';

//Maybe you can try to explode your input into array first with comma :

$input_array = explode(",",$input);

//Then you check whether there is second value in your array or not, if yes then take the second value, else take the first one:

$value = count($input_array) > 1 ? $input_array[1] : $input_array[0];

//Here you will always get the right value :

echo $value;