Difference between revisions of "SUBSTRING"
From SQLZOO
| Line 17: | Line 17: | ||
<div class='ht'> | <div class='ht'> | ||
| − | |||
| − | |||
<source lang='sql' class='def e-oracle'> | <source lang='sql' class='def e-oracle'> | ||
SELECT name, | SELECT name, | ||
Revision as of 14:19, 16 July 2012
| SUBSTRING(s FROM i FOR j) | ||
|---|---|---|
| Engine | OK | Alternative |
| ingres | Yes | SUBSTRING(s FROM i FOR j) |
| mysql | Yes | SUBSTRING(s FROM i FOR j) |
| oracle | No | SUBSTR(s,i,j) |
| postgres | Yes | SUBSTRING(s FROM i FOR j) |
| sqlserver | Yes | |
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