更改包含数据数组

时间:2017-09-18 00:48:53

标签: mysql sql postgresql

我的表格列中包含以下类型的数据:列名称'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>

我需要一个sql语句,找到href="http并将其更改为https。

1 个答案:

答案 0 :(得分:1)

我认为你会使用replace()

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

您可以将其置于更新中:

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