Difference between revisions of "DAY"

From SQLZOO
Jump to: navigation, search
(Created page with "<table align='right' border='1'> <caption>Compatibility</caption> <tr><th colspan='3'>DAY(d)</th></tr> <tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</td>...")
 
Line 19: Line 19:
 
In this example you get the day from the date field whn.  
 
In this example you get the day from the date field whn.  
 
<source lang='sql' class='def e-ingres'>
 
<source lang='sql' class='def e-ingres'>
SELECT EXTRACT(DAY from d) AS v
+
SELECT EXTRACT(DAY from whn) AS v
 
       ,whn
 
       ,whn
 
       ,wht
 
       ,wht
Line 25: Line 25:
 
</source>
 
</source>
 
<source lang='sql' class='def e-postgres'>
 
<source lang='sql' class='def e-postgres'>
SELECT EXTRACT(DAY from d) AS v
+
SELECT EXTRACT(DAY from whn) AS v
 
       ,whn
 
       ,whn
 
       ,wht
 
       ,wht

Revision as of 11:57, 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 eclipse
SELECT DAY(whn) AS v
      ,whn
      ,wht
  FROM eclipse

See also

Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense