Have a look at the REPLACE
function. You'll need to use it twice to remove both http and https.
UPDATE list
SET website = REPLACE(REPLACE(website, 'https://', ''), 'http://', '')
WHERE website like 'https://%'
OR website like 'http://%'
To handle trailing slashes, you can use the RIGHT
, LEFT
, and LENGTH
functions.
UPDATE list
SET website = LEFT(website, LENGTH(website) - 1)
WHERE RIGHT(website, 1) = '/'
Here is some documentation that you may find useful:
MySQL string functions