Create a Slug From a Name in MySQL/MariaDB


How to create a slug from the name of an item in MySQL/MariaDB.

UPDATE my_table
SET slug = LOWER(REGEXP_REPLACE(REPLACE(REPLACE(REPLACE(name, ' ', '-'), 'and', '-'), '[^a-zA-Z0-9-]', ''), '-+', '-'));