How to use SUBSTR Function In SQL
The SUBSTR function is used to extract a substring from the given string.
Syntax:
SUBSTR( String , Starting Position , Desired Length)
In this example, we are going to explore SUBSTR function. We are going to cover is basic syntax with well structured example.
Query:
UPDATE w3wiki
SET courses = SUBSTR(courses, 1, 4)
WHERE courses LIKE 'DSA%' ;
Output:
Explanation : In this example, we have used SUBSTR function to extract a part of the string. We have specified changes in courses column where string starts with DSA. We have extract DSA from the string and set it to the column’s value.
How to UPDATE and REPLACE Part of a String in SQLite
In SQLite, updating and replacing parts of a string can be a common task, especially when dealing with textual data. SQLite, serverless architecture offers various methods to solve this problem. In this article, We will learn about string replace in a query with the help of various methods to know how to update and replace a part of the string in SQLite and so on.