
- 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 can we use INSERT() function to insert a new string into the value of a column of MySQL table?
For this purpose, We need to use the name of the column as the first parameter i.e. at the place of an original string, of the INSERT() function. Following example will exhibit it −
Example
Suppose we want to add ‘/Old’ with the values of ‘year_of_admission’ column of ‘Student’ table then we need to write following query −
mysql> Select INSERT(year_of_admission,5,0,'/Old')As 'Old Admissions' From Student; +-----------------+ | Old Admissions | +-----------------+ | 2001/Old | | 2010/Old | | 2009/Old | | 2017/Old | | 2000/Old | +-----------------+ 5 rows in set (0.00 sec)
We can also apply WHERE clause, as follows, in the above query −
mysql> Select INSERT(year_of_admission,5,0,'/Old')As 'Old Admissions' From Student WHERE year_of_admission < '2017'; +----------------+ | Old Admissions | +----------------+ | 2001/Old | | 2010/Old | | 2009/Old | | 2000/Old | +----------------+ 4 rows in set (0.00 sec)
- Related Articles
- How can we insert a new row into a MySQL table?
- How can we insert data into a MySQL table?
- How can we insert current date automatically in a column of MySQL table?
- How can we insert current year automatically in a YEAR type column of MySQL table?
- How can we insert values into a table with the help of MySQL self-computed output?
- How to insert DATE into a MySQL column value using Java?
- How can we use MySQL EXPORT_SET() function with column of a table?
- How can we use WHERE clause with MySQL INSERT INTO command?
- How to insert only a single column into a MySQL table with Java?
- How do I INSERT INTO from one MySQL table into another table and set the value of one column?
- Insert JSON into a MySQL table?
- How can we use a MySQL subquery with INSERT statement?
- How can I insert a value in a column at the place of NULL using MySQL COALESCE() function?
- How would you insert a new user into a MySQL table from within Laravel?
- Insert NULL value into INT column in MySQL?

Advertisements