Difference between revisions of "SUBSTR/de"

From SQLZOO
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
 
<table align='right' border='1'>
 
<table align='right' border='1'>
 
<caption>Kompatibilität</caption>
 
<caption>Kompatibilität</caption>
<tr><th colspan='3'>SUBSTRING(s FROM i FOR j)</th></tr>
+
<tr><th colspan='3'>SUBSTR(s, i, j)</th></tr>
 
<tr><td align='center'>'''DBMS'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
 
<tr><td align='center'>'''DBMS'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
 
<tr><td align='left'>Ingres</td><td>Ja</td><td>[[SUBSTRING(ansi)/de | SUBSTRING(s FROM i FOR j)]]</td></tr>
 
<tr><td align='left'>Ingres</td><td>Ja</td><td>[[SUBSTRING(ansi)/de | SUBSTRING(s FROM i FOR j)]]</td></tr>
Line 15: Line 15:
 
<p></p>  
 
<p></p>  
 
<pre style='width:75ex'>
 
<pre style='width:75ex'>
   SUBSTR('Hello world', 2, 3) -> 'llo'     
+
   SUBSTR('Hallo Welt', 2, 3) -> 'llo'     
 
</pre>
 
</pre>
  

Latest revision as of 12:47, 28 October 2012

Kompatibilität
SUBSTR(s, i, j)
DBMSOKAlternative
IngresJa SUBSTRING(s FROM i FOR j)
MySQLJaSUBSTRING(s FROM i FOR j)
OracleJa
PostgreSQLJa SUBSTRING(s FROM i FOR j)
SQL ServerNein SUBSTRING(s,i,j)

SUBSTR

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

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

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

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