https://www.plus2net.com/sql_tutorial/group_concat.php
How many forward slash ( / ) present in above string SELECT CHARACTER_LENGTH('https://www.plus2net.com/sql_tutorial/group_concat.php')
Output is 54 SELECT REPLACE('https://www.plus2net.com/sql_tutorial/group_concat.php','/','')
Step 3 : We will count the number of characters present in the string after the replacement.
SELECT CHARACTER_LENGTH(REPLACE('https://www.plus2net.com/sql_tutorial/group_concat.php','/',''))
Output is 50. SELECT
CHARACTER_LENGTH('https://www.plus2net.com/sql_tutorial/group_concat.php') -
CHARACTER_LENGTH(REPLACE('https://www.plus2net.com/sql_tutorial/group_concat.php','/',''))
Output is 4 SELECT
CHARACTER_LENGTH('https://www.plus2net.com/sql_tutorial/group_concat.php') -
CHARACTER_LENGTH(REPLACE('https://www.plus2net.com/sql_tutorial/group_concat.php','.',''))
Output is 3 SELECT (
CHARACTER_LENGTH('https://www.plus2net.com/sql_tutorial/sql_count.php') -
CHARACTER_LENGTH(REPLACE('https://www.plus2net.com/sql_tutorial/sql_count.php','sql',''))
) / CHARACTER_LENGTH('sql')
Output is 2
SELECT * FROM `student` WHERE
(
CHARACTER_LENGTH(name) -
CHARACTER_LENGTH(REPLACE(name,'John',''))
) / CHARACTER_LENGTH('John') >0
We will get a list of names with 'John' inside them.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.