Difference between revisions of "SQL Functions"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 2: Line 2:


===Logical Functions===
===Logical Functions===
:;IF:
:{|
:;IFNULL:
| '''IF''' ||
| IFNULL ||
|}
                  
                  
===String Functions===
===String Functions===
:;CONCAT:
:{|
:;LENGTH:
| '''CONCAT''' ||
| '''LENGTH''' ||
|}


===Date Functions===
===Date Functions===
:;DATE_ADD:
:{|
:;DATEDIFF:
| '''DATE_ADD''' ||
:;CURDATE:
| '''DATEDIFF''' ||
:;NOW:
| '''CURDATE''' ||
:;CURTIME:
| '''NOW''' ||
:;DATE_FORMAT:
| '''CURTIME''' ||
:;DATE_SUB:
| '''DATE_FORMAT''' ||
:;DATE:
| '''DATE_SUB''' ||
:;DAYOFMONTH:
| '''DATE''' ||
:;DAYNAME:
| '''DAYOFMONTH''' ||
:;DAYOFWEEK:
| '''DAYNAME''' ||
:;DAYOFYEAR:
| '''DAYOFWEEK''' ||
:;EXTRACT:
| '''DAYOFYEAR''' ||
:;FROM_UNIXTIME:
| '''EXTRACT''' ||
:;HOUR:
| '''FROM_UNIXTIME''' ||
:;LAST_DAY:
| '''HOUR''' ||
:;MINUTE:
| '''LAST_DAY''' ||
:;MONTH:
| '''MINUTE''' ||
:;MONTHNAME:
| '''MONTH''' ||
:;SEC_TO_TIME:
| '''MONTHNAME''' ||
:;SECOND:
| '''SEC_TO_TIME''' ||
:;STR_TO_DATE:
| '''SECOND''' ||
:;SUBTIME:
| '''STR_TO_DATE''' ||
:;TIME_TO_SEC:
| '''SUBTIME''' ||
:;TIME:
| '''TIME_TO_SEC''' ||
:;TIMEDIFF:
| '''TIME''' ||
:;TO_DAYS:
| '''TIMEDIFF''' ||
:;UNIX_TIMESTAMP:
| '''TO_DAYS''' ||
:;YEAR:
| '''UNIX_TIMESTAMP''' ||
               
| '''YEAR''' ||
|}       
 
===Aggregate Functions===
===Aggregate Functions===
:;SUM:
:{|
:;AVG:
| '''SUM''' ||
:;COUNT:
| '''AVG''' ||
:;MAX:
| '''COUNT''' ||
:;MIN:
| '''MAX''' ||
:;STD:
| '''MIN''' ||
:;VARIANCE:
| '''STD''' ||
:;ROUND:
| '''VARIANCE''' ||
| '''ROUND''' ||
|}


===Miscellaneous Functions===
===Miscellaneous Functions===
:;DISTINCT:
:{|
| '''DISTINCT''' ||
|}

Revision as of 01:24, 11 November 2011

These functions can be used in your SQL statements.

Logical Functions

IF IFNULL

String Functions

CONCAT LENGTH

Date Functions

DATE_ADD DATEDIFF CURDATE NOW CURTIME DATE_FORMAT DATE_SUB DATE DAYOFMONTH DAYNAME DAYOFWEEK DAYOFYEAR EXTRACT FROM_UNIXTIME HOUR LAST_DAY MINUTE MONTH MONTHNAME SEC_TO_TIME SECOND STR_TO_DATE SUBTIME TIME_TO_SEC TIME TIMEDIFF TO_DAYS UNIX_TIMESTAMP YEAR

Aggregate Functions

SUM AVG COUNT MAX MIN STD VARIANCE ROUND

Miscellaneous Functions

DISTINCT