Dividir una cadena en columnas:
select date,
substring_index(cost, '-', 1) type_a,
case when cost regexp '.*-' then
substring_index(substring_index(cost, '-', 2), '-', -1)
else ''
end type_b,
case when cost regexp '.*-.*-' then
substring_index(substring_index(cost, '-', 3), '-', -1)
else ''
end type_c,
case when cost regexp '.*-.*-.*-' then
substring_index(substring_index(cost, '-', 4), '-', -1)
else ''
end type_d,
case when cost regexp '.*-.*-.*-.*-' then
substring_index(substring_index(cost, '-', 5), '-', -1)
else ''
end type_e
from rate_cost;
Si puede modificar el diseño de la tabla, es mejor crear varias columnas:
create table rate_cost (
id int,
rate int,
hotel int,
cost_type_a int,
cost_type_b int,
cost_type_c int,
cost_type_d int,
cost_type_e int,
date date);