Difference between revisions of "SUBSTR"

From SQLZOO
Jump to: navigation, search
Line 8: Line 8:
 
<tr><td align='left'>sqlserver</td><td>No</td><td>[[SUBSTRING |SUBSTRING(s,i,j)]]</td></tr>
 
<tr><td align='left'>sqlserver</td><td>No</td><td>[[SUBSTRING |SUBSTRING(s,i,j)]]</td></tr>
 
</table>
 
</table>
 +
 
<h1> SUBSTR</h1>
 
<h1> SUBSTR</h1>
 
<p>SUBSTR allows you to extract part of a string. </p>
 
<p>SUBSTR allows you to extract part of a string. </p>
Line 29: Line 30:
 
</source>
 
</source>
 
</div>
 
</div>
 +
 +
{{Languages}}

Revision as of 10:52, 28 October 2012

Compatibility
SUBSTRING(s FROM i FOR j)
EngineOKAlternative
ingresYesSUBSTRING(s FROM i FOR j)
oracleYes
postgresYesSUBSTRING(s FROM i FOR j)
sqlserverNoSUBSTRING(s,i,j)

SUBSTR

SUBSTR allows you to extract part of a string.

   SUBSTR('Hello world', 2, 3) -> 'llo'    

In this example you put the region and the name together for each country.

SELECT name,
       SUBSTRING(name, 2, 5)
  FROM bbc
SELECT name,
       SUBSTR(name, 2, 5)
  FROM bbc
Language: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense