Difference between revisions of "SQL Functions"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric |
||
Line 4: | Line 4: | ||
:{| | :{| | ||
| '''IF''' || | | '''IF''' || | ||
| IFNULL || | |- | ||
| '''IFNULL''' || | |||
|} | |} | ||
Line 10: | Line 11: | ||
:{| | :{| | ||
| '''CONCAT''' || | | '''CONCAT''' || | ||
|- | |||
| '''LENGTH''' || | | '''LENGTH''' || | ||
|} | |} | ||
Line 16: | Line 18: | ||
:{| | :{| | ||
| '''DATE_ADD''' || | | '''DATE_ADD''' || | ||
|- | |||
| '''DATEDIFF''' || | | '''DATEDIFF''' || | ||
|- | |||
| '''CURDATE''' || | | '''CURDATE''' || | ||
|- | |||
| '''NOW''' || | | '''NOW''' || | ||
|- | |||
| '''CURTIME''' || | | '''CURTIME''' || | ||
|- | |||
| '''DATE_FORMAT''' || | | '''DATE_FORMAT''' || | ||
|- | |||
| '''DATE_SUB''' || | | '''DATE_SUB''' || | ||
|- | |||
| '''DATE''' || | | '''DATE''' || | ||
|- | |||
| '''DAYOFMONTH''' || | | '''DAYOFMONTH''' || | ||
|- | |||
| '''DAYNAME''' || | | '''DAYNAME''' || | ||
|- | |||
| '''DAYOFWEEK''' || | | '''DAYOFWEEK''' || | ||
|- | |||
| '''DAYOFYEAR''' || | | '''DAYOFYEAR''' || | ||
|- | |||
| '''EXTRACT''' || | | '''EXTRACT''' || | ||
|- | |||
| '''FROM_UNIXTIME''' || | | '''FROM_UNIXTIME''' || | ||
|- | |||
| '''HOUR''' || | | '''HOUR''' || | ||
|- | |||
| '''LAST_DAY''' || | | '''LAST_DAY''' || | ||
|- | |||
| '''MINUTE''' || | | '''MINUTE''' || | ||
|- | |||
| '''MONTH''' || | | '''MONTH''' || | ||
|- | |||
| '''MONTHNAME''' || | | '''MONTHNAME''' || | ||
|- | |||
| '''SEC_TO_TIME''' || | | '''SEC_TO_TIME''' || | ||
|- | |||
| '''SECOND''' || | | '''SECOND''' || | ||
|- | |||
| '''STR_TO_DATE''' || | | '''STR_TO_DATE''' || | ||
|- | |||
| '''SUBTIME''' || | | '''SUBTIME''' || | ||
|- | |||
| '''TIME_TO_SEC''' || | | '''TIME_TO_SEC''' || | ||
|- | |||
| '''TIME''' || | | '''TIME''' || | ||
|- | |||
| '''TIMEDIFF''' || | | '''TIMEDIFF''' || | ||
|- | |||
| '''TO_DAYS''' || | | '''TO_DAYS''' || | ||
|- | |||
| '''UNIX_TIMESTAMP''' || | | '''UNIX_TIMESTAMP''' || | ||
|- | |||
| '''YEAR''' || | | '''YEAR''' || | ||
|} | |} | ||
Line 49: | Line 79: | ||
:{| | :{| | ||
| '''SUM''' || | | '''SUM''' || | ||
|- | |||
| '''AVG''' || | | '''AVG''' || | ||
|- | |||
| '''COUNT''' || | | '''COUNT''' || | ||
|- | |||
| '''MAX''' || | | '''MAX''' || | ||
|- | |||
| '''MIN''' || | | '''MIN''' || | ||
|- | |||
| '''STD''' || | | '''STD''' || | ||
|- | |||
| '''VARIANCE''' || | | '''VARIANCE''' || | ||
|- | |||
| '''ROUND''' || | | '''ROUND''' || | ||
|} | |} |
Revision as of 01:27, 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