I am having the table with the following structure
----------------------------
id content
---------------------------
1 abc
2 bca
---------------------------
I want to append the character 'd' with the field 'content' ... So i want the table structure as follows
----------------------------
id content
---------------------------
1 abcd
2 bca
---------------------------
How can i do this..
You can append data to a MySQL database field with the help of in-built CONCAT() function. Here is the query to append the data ”Taylor” to the data already in the column. Therefore, the data will get appended.
To prepend a string to a column value in MySQL, we can use the function CONCAT. The CONCAT function can be used with UPDATE statement.
The syntax to modify a column in a table in MySQL (using the ALTER TABLE statement) is: ALTER TABLE table_name MODIFY column_name column_definition [ FIRST | AFTER column_name ]; table_name. The name of the table to modify.
On the Home tab, in the View group, click View, and then click Design View. On the Design tab, in the Query Type group, click Append. The Append dialog box appears. Next, you specify whether to append records to a table in the current database, or to a table in a different database.
If you want update the column from the Table then use below Query
update table1 set content = concat(content,'d');
If you want to select the column concatenation with 'd; the use below Query
select id, concat(content,'d') as content from table1;
Refer :
http://sqlfiddle.com/#!2/099c8/1
You can use the CONCAT
, like so
SELECT
id,
CONCAT(content, 'd') content
FROM tablename;
You can also specify a WHERE
clause to determine which rows to update. Something like:
SELECT
id,
CONCAT(content, 'd') content
FROM tablename
WHERE id = 1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With