
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to use REPLACE() function with column’s data of MySQL table?
For using it with column’s data we need to provide column name as the argument of REPLACE() function. It can be demonstrated by using ‘Student’ table data as follows −
Example
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)
- Related Articles
- How can we use MySQL POWER() function with the column’s data values?
- How can we use MySQL REVERSE() function on column’s data along with WHERE clause?
- How can MySQL find and replace the data with REPLACE() function to UPDATE the table?
- How can we use MySQL EXPORT_SET() function with column of a table?
- How to replace rows in a MySQL table with conditions?
- How can we use MySQL REPLACE statement to prevent of insertion of duplicate data?
- How can I modify an existing MySQL column’s data type?
- How can I use MySQL INTERVAL() function with a column of a table?
- How to use MySQL SOUNDEX() function with LIKE operator to retrieve the records from table?
- How can we amend the declared size of a column’s data type in MySQL?
- How can MySQL REPLACE() function be used with WHERE clause?
- How to use an OUT parameter / read data with SELECT from table in a MySQL procedure?
- How can I get the output based on comparison done with column’s name using MySQL IN() function?
- How to replace a character in a MySQL table?
- How can I use MySQL replace() to replace strings in multiple records?

Advertisements