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

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