Difference between revisions of "SUBSTRING"

From SQLZOO
Jump to: navigation, search
Line 17: Line 17:
  
 
<div class='ht'>
 
<div class='ht'>
In this example you put the region and the name together for each country. 
 
 
 
<source lang='sql' class='def e-oracle'>
 
<source lang='sql' class='def e-oracle'>
 
SELECT name,
 
SELECT name,

Revision as of 15:19, 16 July 2012

Compatibility
SUBSTRING(s FROM i FOR j)
EngineOKAlternative
ingresYesSUBSTRING(s FROM i FOR j)
mysqlYesSUBSTRING(s FROM i FOR j)
oracleNoSUBSTR(s,i,j)
postgresYesSUBSTRING(s FROM i FOR j)
sqlserverYes

SUBSTRING

SUBSTRING allows you to extract part of a string.

   SUBSTRING('Hello world', 2, 3) -> 'llo'    
SELECT name,
       SUBSTR(name, 2, 5)
  FROM bbc
SELECT name,
       SUBSTRING(name, 2, 5)
  FROM bbc
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense