SUBSTR

From SQLZOO
Revision as of 15:22, 16 July 2012 by Connor (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense