REPLACE(string,from_string,to_string)

Description: Replaces all occurrences of from_string with to_string within string, and returns the result.

Examples:

  • REPLACE('John Smith',' ','') returns JohnSmith.

  • REPLACE('HTTP://mysite.com','HTTP','http') returns http://mysite.com.

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.