Difference between revisions of "REPLACE"

From SQLZOO
Jump to: navigation, search
Line 1: Line 1:
 
<table align='right' border='1'>
 
<table align='right' border='1'>
 
<caption>Compatibility</caption>
 
<caption>Compatibility</caption>
<tr><th colspan='3'>REPLACE(f)</th></tr>
+
<tr><th colspan='3'>REPLACE(f, s1, s2)</th></tr>
 
<tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
 
<tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
 
<tr><td align='left'>ingres</td><td>Yes</td><td></td></tr>
 
<tr><td align='left'>ingres</td><td>Yes</td><td></td></tr>

Revision as of 11:52, 13 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