如何使用REPLACE()函数替换MySQL表格中的列数据?

如何使用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)

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程