Difference between revisions of "MONTH"
From SQLZOO
| Line 10: | Line 10: | ||
</table> | </table> | ||
<h1>MONTH</h1> | <h1>MONTH</h1> | ||
| − | <p>MONTH allows you to retrieve the | + | <p>MONTH allows you to retrieve the month from a date.</p> |
<p></p> | <p></p> | ||
<pre style='width:60ex'> | <pre style='width:60ex'> | ||
Latest revision as of 21:24, 21 October 2012
| MONTH(d) | ||
|---|---|---|
| Engine | OK | Alternative |
| ingres | Yes | EXTRACT(MONTH from d) |
| mysql | Yes | EXTRACT(MONTH from d) |
| oracle | No | TO_CHAR(d,'MM') |
| postgres | No | EXTRACT(MONTH from d) |
| sqlserver | Yes | DATEPART(MONTH,d) |
MONTH
MONTH allows you to retrieve the month from a date.
MONTH(d)
In this example you get the month from the date field whn.
SELECT EXTRACT(MONTH FROM whn) AS v ,whn ,wht FROM eclipse
SELECT TO_CHAR(whn,'MONTH') AS v ,whn ,wht FROM gisq.eclipse
SELECT MONTH(whn) AS v, whn, wht FROM eclipse
See also
| Language: | English • Deutsch |
|---|