Use of built-in functions in the database This article mainly introduces the use of built-in functions in the database, mainly date functions, string functions, and mathematical functions. 1. Date functions select current_date();//Get the current date, year, month, and dayselect current_time();//Get the current time, hours, minutes, and secondsselect current_timestamp();//Get the current year, month, day, hours, minutes, and secondsselect date('2017-10-28');//Get the parameter dateselect date_add('2017-10-28', interval 10 day);//Add the specified year/month/day to the parameter dateselect date_sub('2017-10-28', interval 10 day);//Subtract the specified year/month/day from the parameter dateselect datediff('2017-10-10', '2016-9-1');//Calculate the number of days between two dates (II) String functions (III) Mathematical functions Other functions
//user() queries the current userselect user(); //md5(str) performs md5 digest on a string and obtains a 32-bit string after digest select md5('admin') //database() displays the database currently in use select database(); //password() function, MySQL database uses this function to encrypt users select password('root'); //ifnull(val1, val2) If val1 is null, return val2, otherwise return the value of val1 select ifnull('abc', '123'); // abc is not null, so return abc The above is what I introduced to you: MySQL Database 8 - Detailed explanation and integration of the application of functions in the database. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: How to resize partitions in CentOS7
>>: Detailed explanation of vue simple notepad development
The parameter passed by ${param} will be treated ...
I don't know if you have noticed when making a...
First download JDK. Here we use jdk-8u181-linux-x...
Table of contents Problem Description The general...
1. Install Python 3 1. Install dependency package...
According to the principles of W3C, each start tag...
This article example shares the specific code of ...
mysql dirty pages Due to the WAL mechanism, when ...
Every qualified Linux operation and maintenance p...
First, let’s look at the GIF operation: Case 1: S...
Table of contents Quick Start How to use Core Pri...
Everything needs a foundation. To build a house, ...
Transaction A transaction is a basic unit of busi...
MySQL is a relational database management system....
MySQL replace and replace into are both frequentl...