Difference between revisions of "DAY"

From SQLZOO
Jump to: navigation, search
Line 34: Line 34:
 
       ,whn
 
       ,whn
 
       ,wht
 
       ,wht
   FROM eclipse
+
   FROM gisq.eclipse
 
</source>
 
</source>
 
<source lang='sql' class='def'>
 
<source lang='sql' class='def'>

Revision as of 14:54, 16 July 2012

Compatibility
DAY(d)
EngineOKAlternative
ingresNoEXTRACT(DAY from d)
mysqlYesEXTRACT(DAY from d)
oracleNoTO_CHAR(d,'DD')
postgresNoEXTRACT(DAY from d)
sqlserverYesDATEPART(DAY,d)

DAY

DAY allows you to retrieve the day from a date.

   DAY(d)

In this example you get the day from the date field whn.

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

See also

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense