SelectName,REPLACE(Name,'G','S')ASName_ChangedfromstudentWhereSubject='Computers';+--------+----------- ---+|Name|Name_Changed|+--------+--------------+|Gaurav|Saurav||Gau"/> SelectName,REPLACE(Name,'G','S')ASName_ChangedfromstudentWhereSubject='Computers';+--------+----------- ---+|Name|Name_Changed|+--------+--------------+|Gaurav|Saurav||Gau">

Home  >  Article  >  Database  >  How to get the value of REPLACE() function in the column name we selected?

How to get the value of REPLACE() function in the column name we selected?

PHPz
PHPzforward
2023-09-10 11:49:02867browse

如何在我们选择的列名中获取 REPLACE() 函数的值?

In order to get the value of the REPLACE() function in the column name we selected, we need to use the keyword "AS" in the REPLACE() function.

The Chinese translation of

Example

is:

Example

mysql> Select Name, REPLACE(Name, 'G','S') AS Name_Changed from student Where Subject = 'Computers';
+--------+--------------+
| Name   | Name_Changed |
+--------+--------------+
| Gaurav | Saurav       |
| Gaurav | Saurav       |
+--------+--------------+
2 rows in set (0.00 sec)

The above query will give the result set of the REPLACE() function in our selected column name "Name_Changed" which is given after the keyword "AS".

The above is the detailed content of How to get the value of REPLACE() function in the column name we selected?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete