QUARTER/de

From SQLZOO
< QUARTER
Revision as of 22:32, 21 October 2012 by Peter (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Kompatibilität
QUARTER(d)
DBMSOKAlternative
IngresJa EXTRACT(QUARTER from d)
MySQLJa EXTRACT(QUARTER from d)
OracleNein TO_CHAR(d,'Q')
PostgreSQLNein EXTRACT(QUARTER from d)
SQL ServerNein DATEPART(QUARTER,d)

QUARTER

QUARTER liefert das Quartal (3-Monats-Periode) aus einem Datumswert.

QUARTALE
1. Quartal1. Januar31. März
2. Quartal1. April30. Juni
3. Quartal1. Juli30. September
4. Quartal1. Oktober31. Dezember
   QUARTER(d)

In diesem Beispiel wird das Quartal des wk-Datums ermittelt. Cliff Richard scheint das 4. Quartal zu bevorzugen. ;)

SELECT wk,
       EXTRACT(QUARTER FROM wk) AS Quarter,
       song
  FROM totp
 WHERE singer = 'Cliff Richard'
 ORDER BY wk DESC
SELECT wk,
       TO_CHAR(wk,'QUARTER') AS Quarter,
       song
  FROM gisq.totp
 WHERE singer = 'Cliff Richard'
 ORDER BY wk DESC
SELECT wk,
       DATEPART(QUARTER,wk) AS Quarter,
       song
  FROM totp
 WHERE singer = 'Cliff Richard'
 ORDER BY wk DESC
SELECT wk,
       QUARTER(wk) AS Quarter,
       song
  FROM totp
 WHERE singer = 'Cliff Richard'
 ORDER BY wk DESC

Siehe auch

Sprache: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense