如何使用REPLACE()函数替换MySQL表格中的列数据?
要使用REPLACE()函数替换列数据,我们需要将列名提供为REPLACE()函数的参数。可以使用’Student’表格的数据来演示如下。
阅读更多:MySQL 教程
示例
mysql> Select Id, Name, Subject, REPLACE(Subject, 's', ' Science') from Student WHERE Subject = 'Computers';
+------+--------+-----------+-----------------------------------+
| Id | Name | Subject | REPLACE(Subject, 's', ' Science') |
+------+--------+-----------+-----------------------------------+
| 1 | Gaurav | Computers | Computer Science |
| 20 | Gaurav | Computers | Computer Science |
+------+--------+-----------+-----------------------------------+
2 rows in set (0.00 sec)