SUBSTR
From SQLZoo
SUBSTR(s, i, j) | ||
---|---|---|
Engine | OK | Alternative |
ingres | Yes | SUBSTRING(s FROM i FOR j) |
mysql | Yes | SUBSTRING(s FROM i FOR j) |
oracle | Yes | |
postgres | Yes | SUBSTRING(s FROM i FOR j) |
sqlserver | No | SUBSTRING(s,i,j) |
SUBSTR
SUBSTR allows you to extract part of a string.
SUBSTR('Hello world', 2, 3) -> 'ell'
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 |
---|