Home > Back-end >  SqlYog commonly used function
SqlYog commonly used function

Time:10-03

common function - aggregation function
AVG () returns the mean value of a field
The COUNT () returns a field the number of rows
MAX () returns a maximum of one field
The MIN () returns the minimum value of a field
And of the SUM () returns a field

common function - string functions
CONCAT (str1, str1... STRN) : string concatenation code: - SELECT CONCAT (' My 'and' S ', 'QL); return: MySQL
INSERT (STR, pos, len, newstr) : string replacement code: - SELECT INSERT (' this is the SQL Server database, 3, 10, 'MySQL'); return: this is a MySQL database
The LOWER (STR) how it works: a string to lowercase code: - SELECT the LOWER (' MySQL '); return: mysql
The UPPER (STR) : the string to uppercase code: - SELECT UPPER (' MySQL '); return: MYSQL
The SUBSTRING (STR, num, len) : string interception code: - SELECT SUBSTRING (' JavaMySQLOracle ', 5, 5); return: MySQL
note: subscript starting from 1, contains the first number, the second number in the future, the number of words

common function - date function
CURDATE () get the current date SELECT CURDATE (); return: year - month - day
CURTIME () get the current time SELECT CURTIME (); return: - cent -
NOW () get the current date and time SELECT NOW (); return: on - - - - - second
WEEK (date) return date date for how many weeks of the year SELECT WEEK (NOW ()); return: how many weeks
YEAR (date) return date of the year of the date SELECT YEAR (NOW ()); return: the year
HOUR (time) return time hours of time value SELECT HOUR (NOW ()); return: now the hours of time
The MINUTE (time) return time minutes of time value SELECT MINUTE (NOW ()); return: now the minutes
DATEDIFF (date1 and date2) return date parameters between date1 and date2 are the number of days apart SELECT DATEDIFF (NOW (), '2008-8-8'); return: how many days are there between the two time
ADDDATE (date, n) date parameters calculated date plus n days after the date of the SELECT ADDDATE (NOW (), 5); return: the current time plus n time

common function - mathematical functions
The CEIL (x) returns the smallest integer greater than or equal to the numerical x SELECT CEIL (2.3); return: 3
The FLOOR (x) returns the largest integer less than or equal to the value x SELECT FLOOR (2.3); return: 2
RAND () returns a random number between 0 ~ 1 SELECT RAND (); Work: 0.5525468583708134
  • Related