Difference between pages "SELECT from BBC Tutorial" and "HOUR/de"

From SQLZOO
(Difference between pages)
Jump to: navigation, search
(Created page with "==BBC Country Profiles== This tutorial introduces SQL as a query language. We will be using the SELECT command on the table bbc: <table style='' border='1'><tr> <th>name</th>...")
 
 
Line 1: Line 1:
==BBC Country Profiles==
+
[[Category:Deutsch]]
This tutorial introduces SQL as a  query language. We will be using the SELECT command on the table bbc:
+
<table align='right' border='1'>
<table style='' border='1'><tr>
+
<caption>Kompatibilität</caption>
<th>name</th>
+
<tr><th colspan='3'>HOUR(d)</th></tr>
<th>region</th>
+
<tr><td align='center'>'''DBMS'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
<th>area</th>
+
<tr><td align='left'>Ingres</td><td>Nein</td><td>[[EXTRACT/de | EXTRACT(HOUR from d)]]</td></tr>
<th>population</th>
+
<tr><td align='left'>MySQL</td><td>Ja</td><td>[[EXTRACT/de | EXTRACT(HOUR from d)]]</td></tr>
<th>gdp</th>
+
<tr><td align='left'>Oracle</td><td>Nein</td><td>[[TO_CHAR(dates)/de | TO_CHAR(d,'HH24')]]</td></tr>
</tr>
+
<tr><td align='left'>PostgreSQL</td><td>Nein</td><td>[[EXTRACT/de | EXTRACT(HOUR from d)]]</td></tr>
<tr>
+
<tr><td align='left'>SQL Server</td><td>Ja</td><td>[[DATEPART/de | DATEPART(HOUR,d)]]</td></tr>
<td>Afghanistan</td>
+
<td>South Asia</td>
+
<td align='right'>652225</td>
+
<td align='right'>26000000</td>
+
<td></td>
+
</tr>
+
<tr>
+
<td>Albania</td>
+
<td>Europe</td>
+
<td align='right'>28728</td>
+
<td align='right'>3200000</td>
+
<td align='right'>6656000000</td>
+
</tr>
+
<tr>
+
<td>Algeria</td>
+
<td>Middle East</td>
+
<td align='right'>2400000</td>
+
<td align='right'>32900000</td>
+
<td align='right'>75012000000</td>
+
</tr>
+
<tr>
+
<td>Andorra</td>
+
<td>Europe</td>
+
<td align='right'>468</td>
+
<td align='right'>64000</td>
+
<td></td>
+
</tr>
+
<tr>
+
<td colspan='5'>...</td>
+
</tr>
+
 
</table>
 
</table>
  
==Warming up==
+
<h1>HOUR</h1>
<div class='qu'>
+
<p>HOUR ermittelt die Stunde aus einem Datums-/Zeitwert.</p>
[[Read the notes about this table.]] Observe the result of running a simple SQL command.
+
<p></p>
<source lang='sql' class='def'>
+
<pre style='width:60ex'>
SELECT name, region, population FROM bbc
+
  HOUR(d)
</source>
+
</pre>
  
<source lang='sql' class='ans'>
+
<div class='ht'>
SELECT name, region, population FROM bbc
+
In diesem Beispiel wird die Stunde aus dem <code>whn</code>-Datumswert ermittelt. 
 +
<source lang='sql' class='def e-ingres'>
 +
SELECT EXTRACT(HOUR from whn) AS v
 +
      ,whn
 +
      ,wht
 +
  FROM eclipse
 +
</source>
 +
<source lang='sql' class='def e-postgres'>
 +
SELECT EXTRACT(HOUR from whn) AS v
 +
      ,whn
 +
      ,wht
 +
  FROM eclipse
 +
</source>
 +
<source lang='sql' class='def e-oracle'>
 +
SELECT TO_CHAR(whn,'HOUR') AS v
 +
      ,whn
 +
      ,wht
 +
  FROM gisq.eclipse
 
</source>
 
</source>
</div>
 
 
==Large Countries==
 
<div class='qu'>
 
Show the name for the countries  that have a population of at least 200 million. (200 million is 200000000, there are eight zeros)
 
 
<source lang='sql' class='def'>
 
<source lang='sql' class='def'>
SELECT name FROM bbc
+
SELECT HOUR(whn) AS v, whn, wht
WHERE population>250000000
+
  FROM eclipse
 
</source>
 
</source>
 +
</div>
  
<source lang='sql' class='ans'>
+
<p>Siehe auch</p>
SELECT name FROM bbc
+
<ul>
WHERE population>200000000
+
  <li>[[EXTRACT/de | Funktion EXTRACT]]</li>
</source>
+
  <li>[[%2B(dates)/de | Funktion +(date)]]</li>
</div>
+
  <li>[[MONTH/de | Funktion MONTH]]</li>
 +
  <li>[[MINUTE/de | Funktion MINUTE]]</li>
 +
  <li>[[DAY/de | Funktion DAY]]</li>
 +
  <li>[[SECOND/de | Funktion SECOND]]</li>
 +
</ul>
 +
 
 +
{{Languages}}

Latest revision as of 22:17, 21 October 2012

Kompatibilität
HOUR(d)
DBMSOKAlternative
IngresNein EXTRACT(HOUR from d)
MySQLJa EXTRACT(HOUR from d)
OracleNein TO_CHAR(d,'HH24')
PostgreSQLNein EXTRACT(HOUR from d)
SQL ServerJa DATEPART(HOUR,d)

HOUR

HOUR ermittelt die Stunde aus einem Datums-/Zeitwert.

   HOUR(d)

In diesem Beispiel wird die Stunde aus dem whn-Datumswert ermittelt.

SELECT EXTRACT(HOUR FROM whn) AS v
      ,whn
      ,wht
  FROM eclipse
SELECT EXTRACT(HOUR FROM whn) AS v
      ,whn
      ,wht
  FROM eclipse
SELECT TO_CHAR(whn,'HOUR') AS v
      ,whn
      ,wht
  FROM gisq.eclipse
SELECT HOUR(whn) AS v, whn, wht
  FROM eclipse

Siehe auch

Sprache: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense