Theme
Primary Color
Lesson 25

String Functions – Repeat, Reverse, Replace

الأوامر التي تم كتابتها في الدرس

/*
  Repeat => REPEAT(String, Number Of Repeats)
  text => Field Name
*/

SELECT text, REPEAT(text, 3) AS repeated FROM `try`;

/*
  Replace => REPLACE(String, From, To)
  text => Field Name
*/

SELECT text, REPEAT(text, "a", "@") AS replaced FROM `try`;

SELECT text, REPEAT(text, "http", "https") AS replaced FROM `try`;

UPDATE `try` SET `text` = REPLACE(text, 'http', 'https');

UPDATE `try` SET `text` = REPLACE(text, 'https://', '');

/*
  Reveres => REVERSE(String)
  text => Field Name
*/

SELECT text, REVERSE(text) AS reversed FROM `try`;

UPDATE `try` SET `text` = REVERSE(text);