I have a produto
table filled with 20000 products and I need to add a o
in the first character of the codigo
field of all rows.
How can I do this with MySQL?
I have a produto
table filled with 20000 products and I need to add a o
in the first character of the codigo
field of all rows.
How can I do this with MySQL?
Considering that the column is text type, and that this change will not cause harmful side effects (such as breaking foreign keys), the command is simple:
UPDATE produto
SET codigo = CONCAT('o', codigo);
As in the question there are the unknowns I mentioned above, I recommend backing up the database before doing this.