Reputation:
My database contains a table for students. The student table has a blurb column which is just a short sentence such as "Hi My name is Daniel", "I like chocolate", "I am 25 years old".
I would like to update the blurb column by appending the word 'Key' when the word 'hello' is found. For example, if an entry's blurb is "Hello, my name is Frank", it should become "Hello, my name is Frank Key".
Upvotes: 1
Views: 11145
Reputation: 402
Try this:
update table_name set blurb = blurb + 'Key' where blurb like '%Hello%'
Upvotes: 2
Reputation: 676
I would do it like this in MySQL:
UPDATE students SET blurb = concat(blurb, ' key') WHERE blurb like '%hello%' ;
Upvotes: 0