SUBSTRING

From SQLZoo
Compatibility
SUBSTRING(s, i, 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) -> 'ell'    

In this example you get the 2nd to 5th character from each country's name.

SELECT name,
       SUBSTR(name, 2, 5)
  FROM bbc
SELECT name,
       SUBSTRING(name, 2, 5)
  FROM bbc
Language:Project:Language policy English  • Deutsch