如何将 REPLACE() 函数与 MySQL 表格的列数据一同使用?
要将它与列的数据一同使用,我们需要将列名称作为 REPLACE() 函数的参数提供。它可以按如下方式利用“Student”表格数据进行演示 −
示例
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)
广告