SUBSTRING/de

From SQLZOO
Revision as of 11:47, 28 October 2012 by Peter (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Kompatibilität
SUBSTRING(s, i, j)
DBMSOKAlternative
IngresJa SUBSTRING(s FROM i FOR j)
MySQLJa SUBSTRING(s FROM i FOR j)
OracleNein SUBSTR(s,i,j)
PostgreSQLJa SUBSTRING(s FROM i FOR j)
SQL ServerJa

SUBSTRING

SUBSTRING liefert einen bestimmten Teil einer Zeichenkette. Als Argumente sind die Zeichenkette, der Startpunkt und die Länge des gewünschten Teils anzugeben.

   SUBSTRING('Hallo Welt', 2, 3) -> 'llo'    

In diesem Beispiel wird das 2. bis 5. Zeichen jedes Ländernamens ermittelt.

SELECT name,
       SUBSTR(name, 2, 5)
  FROM bbc
SELECT name,
       SUBSTRING(name, 2, 5)
  FROM bbc
Language:Project:Language policy [[:{{#invoke:String|sub|SUBSTRING/de
 |1
 |Expression error: Unrecognized punctuation character "{".
}}|English]]