SUBSTR

From SQLZOO
Revision as of 11:02, 28 October 2012 by Peter (Talk | contribs)

Jump to: navigation, search
Compatibility
SUBSTR(s, i, j)
EngineOKAlternative
ingresYesSUBSTRING(s FROM i FOR j)
mysqlYesSUBSTRING(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 get the 2nd to 5th character from each country's name.

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