Manipulating Data: Replacing text

  1. Group Selection
  2. Manipulating Data

Sometimes you’ll want to replace text inside of other text. You’ll use the “update” statement for this as well, using the body() function. For example, if you want to replace all occurrences of “Beetles” in your album names with “Beatles”, whether the word occurs on its own or inside some title such as “The Beetles at Carnegie Hall”, you would do this:

update albums set album=replace(album, "Beetles", "Beatles")

Since there is no where portion of the statement, this will affect all records in the albums table.

  1. Group Selection
  2. Manipulating Data