How do I replace a string in SQL and make sure it has no extra spaces?

It was pretty cool that the substring() function had the exact same syntax in all SQL Server, MySQL and PostgreSQL

Are there more functions like that? 

Check out the ones below!

  • replace() = replaces one part of a string with another
  • ltrim() = removes leading spaces from a string
  • rtrim() = removes trailing spaces from a string

have all absolutely identical syntax in all SQL Server, PostgreSQL, MySQL and Vertica. The last three also support trim(), which removes both trailing and leading spaces from a string

 

Wanna check out how these come together in a real-life example?