Prabin Poudel Prabin Poudel - 1 month ago 15
MySQL Question

Alter table columns containing data array

The column of my table that has following kind of data :column name 'html_data':

<h2 class="blue">Safely does it</h2>
<p>Contemplating a dive off your hotel balcony into the pool? Planning to hop onto a
<a href="http://">moped in Bali</a> y risks. Before leaping off into the abyss, check, do you have travel insurance? And if so, would you be covered for <a href="http">?</a></p>
<h2 class="green">Respect the relics</h2>


i need a sql statement that finds the
href="http
and change it to https.

Answer Source

You would use replace(), I think:

select replace(html_data, 'href="http:', 'href='https:')

You can put this in an update:

update t
    set html_data = replace(html_data, 'href="http:', 'href='https:');