MySQL - built-in functions

1. Date function

  •  get year month day

  •  get hours

  • get timestamp 

  • add date to date

 

  •  Subtract time from date

 

  • Calculate the number of days between two dates

 

Create a table to record birthdays

 

 

 Create a table to record strings and record times

2. String functions

  •  Get the character set of a column in the record table

  •  As shown in the figure

  •  Find the number of bytes occupied by the student's name in the student table

 

3. Mathematical functions

  • absolute value

 

  •  Improvement arrangement

  •  adjust down

  •  Two decimal places (rounding)

  •  generate random numbers

 

4. Other functions

  • user() query the current user

  •  md5(str) performs md5 digest on a string, and gets a 32-bit string after digest

  •  show the database we are using

  •  ifnull(val1, val2) If val1 is null, return val2, otherwise return the value of val1

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324305620&siteId=291194637