Difference between revisions of "REPLACE"

From SQLZOO
Jump to: navigation, search
Line 27: Line 27:
 
<p>See also</p>
 
<p>See also</p>
 
<ul>
 
<ul>
   <li>[[SUBSTRING function]]</li>
+
   <li>[[SUSTRING |SUBSTRING function]]</li>
   <li>[[LEFT function]]</li>
+
   <li>[[LEFT |LEFT function]]</li>
   <li>[[RIGHT function]]</li>
+
   <li>[[RIGHT |RIGHT function]]</li>
 
</ul>
 
</ul>

Revision as of 15:22, 16 July 2012

Compatibility
REPLACE(f, s1, s2)
EngineOKAlternative
ingresYes
mysqlYes
oracleYes
postgresYes
sqlserverYes

REPLACE

REPLACE(f, s1, s2) returns the string f with all occurances of s1 replaced with s2.

 REPLACE('vessel','e','a') -> 'vassal'

In this example you remove all the 'a's from the name of each country. This happens because the string 'a' is replaced with .

SELECT name,
       REPLACE(name, 'a','')
  FROM bbc

See also

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense