Last active
August 29, 2015 14:24
-
-
Save dsaiztc/da6ab6d28ccf7171652d to your computer and use it in GitHub Desktop.
SQL functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aggregate functions | |
COUNT(column|*) | |
AVG(column) | |
MIN(column) | |
MAX(column) | |
SUM(column) | |
# Mathematical functions | |
ABS(number) | |
ROUND(number) | |
FLOOR(number) | |
CEILING(number) | |
SQRT(number) | |
POW(base, exponent) | |
RAND() # Random number n, 0<n<1 | |
SIN(number) # Similar cos, etc. | |
# String functions | |
STRCMP(string1, string2) # Compare strings | |
LOWER(string) | |
UPPER(string) | |
LTRIM(string) # Left trim whitespace (similar right) | |
SUBSTRING(string, index1, index2) | |
PASSWORD(string) # Encrypt password | |
ENCODE(string, key) | |
DECODE(string, key) | |
CURDATE() # Get date | |
CURTIME() # Get time | |
DAYNAME(string) # Extract day name from date string | |
DAYOFWEEK(string) # Extract day number from date string | |
MONTHNAME(string) # Extract month from date string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment