Setting up the Table
In this article, we will use the w3wiki table for example.
Table: w3wiki
To Create Table:
CREATE TABLE w3wiki(
id int PRIMARY KEY,
name varchar(100),
course varchar(100)
);
To insert values in the table and display them:
--inserting data to the table
INSERT INTO w3wiki (id, name , course)
VALUES
(1, 'Vishu', 'Python - DSA Self Paced'),
(2, 'Sumit', 'Java Self Paced'),
(3, 'Neeraj', 'Java Self Paced'),
(4, 'Aayush', 'JavaScript Self Paced'),
(5, 'Vivek', 'Python with SQL Self Paced');
--displaying table's data
SELECT* FROM w3wiki;
Using REPLACE Function in SQL
In Structured Query Language (SQL), the REPLACE function is used to replace a substring or a part of a string within the given String. While dealing with some data pre-processing tasks or some data cleaning tasks, the REPLACE function is found to be very useful. It can save a lot of time and it also performs the tasks with great precision. There may be some cases where we need to replace some redundant data with some filler values, in those types of cases REPLACE function can be used.
In this article, we are going to discuss some applications of REPLACE function. We will also discuss some examples related to REPLACE functions with their respective explanations.