Created
November 25, 2017 19:58
-
-
Save cengizhancaliskan/3a4d148ab244bfb7dfeb367fc798f893 to your computer and use it in GitHub Desktop.
Generate slug in mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate slug | |
UPDATE table_name SET slug = replace(trim(lower(name)), ' ', '-'); | |
# check irregular slug.. | |
SELECT * FROM table_name WHERE slug NOT RLIKE '^([a-z0-9]+\-)*[a-z0-9]+$'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment