如何将 REPLACE() 函数用于 MySQL 表的列数据?
要将其与列的数据一起使用,我们需要提供列名称作为 REPLACE() 函数的参数。通过使用“学生”表数据如下所示进行演示 -
示例
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)
广告