Difference between pages "+ INTERVAL/de" and "+ (string)"

From SQLZOO
< + INTERVAL(Difference between pages)
Jump to: navigation, search
 
 
Line 1: Line 1:
[[Category:Deutsch]]
 
<h1>+ INTERVAL</h1>
 
 
<table align='right' border='1'>
 
<table align='right' border='1'>
<caption>Kompatibilität</caption>
+
<caption>Compatibility</caption>
<tr><th colspan='3'>d+ INTERVAL i DAY</th></tr>
+
<tr><th colspan='3'>s1 + s2</th></tr>
<tr><td align='center'>'''DBMS'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
+
<tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
<tr><td align='left'>MySQL</td><td>Ja</td><td>[[%2B(dates)/de |d+ i]]</td></tr>
+
<tr><td align='left'>ingres</td><td>Yes</td><td></td></tr>
<tr><td align='left'>Oracle</td><td>Nein</td><td>[[%2B(dates)/de |d+ i]]</td></tr>
+
<tr><td align='left'>mysql</td><td>No</td><td>[[CONCAT | CONCAT(s1,s2)]]</td></tr>
<tr><td align='left'>PostgreSQL</td><td>Nein</td><td>[[%2B(dates)/de |d+ i]]</td></tr>
+
<tr><td align='left'>oracle</td><td>No</td><td>s1 || s2</td></tr>
<tr><td align='left'>SQL Server</td><td>Nein</td><td>[[%2B(dates)/de |d+ i]]</td></tr>
+
<tr><td align='left'>postgres</td><td>No</td><td>s1 || s2</td></tr>
 +
<tr><td align='left'>sqlserver</td><td>Yes</td><td></td></tr>
 
</table>
 
</table>
 
+
<h1> + (strings)</h1>
<p><code><i>d</i> + INTERVAL <i>i</i> DAY</code>
+
<p>+ allows you to stick two or more strings together. </p>
    liefert ein Datum, das <i>i</i> Tage nach Datum <i>d</i> liegt.
+
<p>This operation is concatenation.</p>  
    </p>
+
<pre style='width:60ex'>
  <p>Ein Datum kann um folgende Zeitintervalle "verschoben" werden: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND.
+
  s1 + s2   
    </p>
+
  <p>Es kann auch ein negativer Wert angegeben werden.
+
    </p>
+
<pre style='width:80ex'>
+
DATE '2006-05-20' + INTERVAL 5 DAY  -> DATE '2006-05-25'
+
DATE '2006-05-20' + INTERVAL 5 MONTH -> DATE '2006-10-20'
+
DATE '2006-05-20' + INTERVAL 5 YEAR  -> DATE '2011-05-20'
+
 
</pre>
 
</pre>
<div class=params>schema:gisq</div>
 
  
 
<div class='ht'>
 
<div class='ht'>
Im Beispiel wird ein Datum 7 Tage nach dem Datumswert in <code>whn</code> ermittelt.  
+
In this example you put the region and the name together for each country.
<source lang='sql' class='def e-oracle'>SELECT whn, (whn) + 7
+
<source lang='sql' class='def e-oracle e-mysql'>
  FROM gisq.eclipse
+
SELECT CONCAT(region,name)
</source>
+
   FROM bbc
<source lang='sql' class='def e-sqlserver'>SELECT whn, (whn) + 7
+
  FROM eclipse
+
</source>
+
<source lang='sql' class='def e-ingres'>SELECT whn, whn + DATE(7 day)
+
   FROM eclipse
+
 
</source>
 
</source>
<source lang='sql' class='def e-postgres'>SELECT whn, whn + 7
+
<source lang='sql' class='def e-oracle e-postgres'>
   FROM eclipse
+
SELECT region || name
 +
   FROM bbc
 
</source>
 
</source>
 
<source lang='sql' class='def'>
 
<source lang='sql' class='def'>
SELECT whn, whn+INTERVAL 7 DAY
+
SELECT region + name
   FROM eclipse
+
   FROM bbc
 
</source>
 
</source>
 
</div>
 
</div>
  
<p>Siehe auch</p>
+
<p>See also</p>
 
<ul>
 
<ul>
   <li>[[EXTRACT/de | Funktion EXTRACT]]</li>
+
   <li>[[SUBSTRING |SUBSTRING function]]</li>
 +
  <li>[[TRIM |TRIM function]]</li>
 
</ul>
 
</ul>
  
 
{{Languages}}
 
{{Languages}}

Latest revision as of 17:21, 21 October 2012

Compatibility
s1 + s2
EngineOKAlternative
ingresYes
mysqlNo CONCAT(s1,s2)
oracleNos1 || s2
postgresNos1 || s2
sqlserverYes

+ (strings)

+ allows you to stick two or more strings together.

This operation is concatenation.

   s1 + s2     

In this example you put the region and the name together for each country.

SELECT CONCAT(region,name)
  FROM bbc
SELECT region || name
  FROM bbc
SELECT region + name
  FROM bbc

See also

Language: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense