QUARTER
QUARTER(d) | ||
---|---|---|
Engine | OK | Alternative |
ingres | Yes | EXTRACT(QUARTER from d) |
mysql | Yes | EXTRACT(QUARTER from d) |
oracle | No | TO_CHAR(d,'Q') |
postgres | No | EXTRACT(QUARTER from d) |
sqlserver | No | DATEPART(QUARTER,d) |
QUARTER
QUARTER allows you to retrieve the 3 month period from a date.
First Quarter | January 1 | March 31 |
Second Quarter | April 1 | June 30 |
Third Quarter | July 1 | September 30 |
Fourth Quarter | October 1 | December 31 |
QUARTER(d)
In this example you get the quarter from the date field wk. Lately, Cliff Richard favours Q4.
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
See also
- EXTRACT function
- +(date) function
- HOUR function
- MINUTE function
- DAY function
- SECOND function
- MONTH function
Language: | English • Deutsch |
---|