QUARTER/de

From SQLZoo
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

Language:Project:Language policy [[:{{#invoke:String|sub|QUARTER/de
 |1
 |Expression error: Unrecognised punctuation character "{".
}}|English]]
DataWars, Data Science Practice Projects - LogoDataWars: Practice Data Science/Analysis with +100 Real Life Projects
  • Your server today is: Laa-Laa