I have a sqlite3 database table. I added a column called title_slug. I want to开发者_如何学Go take the contents of title column, and update the new title_slug column with a slug version. Can I do this straight from sqlite3 or do I have to code it outside of the program?
first of, there are no loops in SQLite. A not very generic solution could be:
UPDATE mytab SET title_slug = replace(replace(title_slug, ' ', '-'), '!', '')
but you would have to add many chars to replace ?!
精彩评论