Re: How to add some char. to a varchar use update query?
If you want to update the value of the email column for every record in the table, then no WHERE clause is necessary:
UPDATE mytable SET email = CONCAT(email, '-');
However, I wouldn't do this, as (1) it's wasteful of space, and (2) if you later need to work with just the email addresses, then you'll have to strip off the dash character again. My choice would be to add the dash as part of a SELECT query. For example, if you want to get the table data in the form
email - firstname lastname
then use the query
SELECT CONCAT(email, ' - ', firstname, ' ', lastname) AS userinfo FROM mytable;
It's inefficient to store repetitive data, and there's almost always a better alternative to doing so.
Jon Stephens
MySQL Documentation Team @ Oracle
MySQL Dev Zone
MySQL Server Documentation
Oracle