To add characters to an existing int column values, use MySQL CONCAT(). Let us first create a table −
mysql> create table DemoTable ( Amount int ); Query OK, 0 rows affected (1.44 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(709); Query OK, 1 row affected (0.67 sec) mysql> insert into DemoTable values(34560); Query OK, 1 row affected (0.30 sec) mysql> insert into DemoTable values(90854); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable values(3456); Query OK, 1 row affected (0.15 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+--------+ | Amount | +--------+ | 709 | | 34560 | | 90854 | | 3456 | +--------+ 4 rows in set (0.00 sec)
Following is the query to add characters in column values −
mysql> select concat('The Product Amount is=',Amount) AS AddingCharacters from DemoTable;
This will produce the following output −
+-----------------------------+ | AddingCharacters | +-----------------------------+ | The Product Amount is=709 | | The Product Amount is=34560 | | The Product Amount is=90854 | | The Product Amount is=3456 | +-----------------------------+ 4 rows in set (0.00 sec)