Difference between revisions of "SECOND"

From SQLZOO
Jump to: navigation, search
(Created page with "<table align='right' border='1'> <caption>Compatibility</caption> <tr><th colspan='3'>SECOND(d)</th></tr> <tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</...")
 
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
<tr><th colspan='3'>SECOND(d)</th></tr>
 
<tr><th colspan='3'>SECOND(d)</th></tr>
 
<tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
 
<tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'''</td><td align='center'>'''Alternative'''</td></tr>
<tr><td align='left'>ingres</td><td>Yes</td><td>[[EXTRACT |EXTRACT(HOUR from d)]]</td></tr>
+
<tr><td align='left'>ingres</td><td>Yes</td><td>[[EXTRACT |EXTRACT(SECOND from d)]]</td></tr>
<tr><td align='left'>mysql</td><td>Yes</td><td>[[EXTRACT |EXTRACT(HOUR from d)]]</td></tr>
+
<tr><td align='left'>mysql</td><td>Yes</td><td>[[EXTRACT |EXTRACT(SECOND from d)]]</td></tr>
<tr><td align='left'>oracle</td><td>No</td><td>[[TO_CHAR(d,'HH24')]]</td></tr>
+
<tr><td align='left'>oracle</td><td>No</td><td>[[TO_CHAR(dates) |TO_CHAR(d,'SS')]]</td></tr>
<tr><td align='left'>postgres</td><td>No</td><td>[[EXTRACT |EXTRACT(HOUR from d)]]</td></tr>
+
<tr><td align='left'>postgres</td><td>No</td><td>[[EXTRACT |EXTRACT(SECOND from d)]]</td></tr>
<tr><td align='left'>sqlserver</td><td>Yes</td><td>[[DATEPART |DATEPART(HOUR,d)]]</td></tr>
+
<tr><td align='left'>sqlserver</td><td>Yes</td><td>[[DATEPART |DATEPART(SECOND,d)]]</td></tr>
 
</table>
 
</table>
 
<h1>SECOND</h1>
 
<h1>SECOND</h1>
Line 13: Line 13:
 
<p></p>  
 
<p></p>  
 
<pre style='width:60ex'>
 
<pre style='width:60ex'>
   HOUR(d)
+
   SECOND(d)
 
</pre>
 
</pre>
  
Line 39: Line 39:
 
<ul>
 
<ul>
 
   <li>[[EXTRACT |EXTRACT function]]</li>
 
   <li>[[EXTRACT |EXTRACT function]]</li>
   <li>[[ +(date) function]]</li>
+
   <li>[[%2B(dates) |+(date) function]]</li>
 
   <li>[[HOUR |HOUR function]]</li>
 
   <li>[[HOUR |HOUR function]]</li>
 
   <li>[[MINUTE |MINUTE function]]</li>
 
   <li>[[MINUTE |MINUTE function]]</li>
Line 45: Line 45:
 
   <li>[[MONTH |MONTH function]]</li>
 
   <li>[[MONTH |MONTH function]]</li>
 
</ul>
 
</ul>
 +
 +
{{Languages}}

Latest revision as of 21:36, 21 October 2012

Compatibility
SECOND(d)
EngineOKAlternative
ingresYesEXTRACT(SECOND from d)
mysqlYesEXTRACT(SECOND from d)
oracleNoTO_CHAR(d,'SS')
postgresNoEXTRACT(SECOND from d)
sqlserverYesDATEPART(SECOND,d)

SECOND

SECOND allows you to retrieve the second from a date.

   SECOND(d)

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

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

See also

Language: English  • Deutsch
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense