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
Regarding uninstalling the previously installed v...
Use jQuery to implement form validation, for your...
Table of contents 1. Current limiting algorithm 2...
Method 1: float:right In addition, floating will ...
Azure Container Registry is a managed, dedicated ...
1. Download mysql-8.0.17-winx64 from the official...
Table of contents 1. Overview of MySQL Logical Ar...
Build the image Earlier we used various images fo...
Container lifecycle The life cycle of a container...
Written in front I have been writing a special to...
Scenario A recent requirement is an h5 page for m...
Table of contents Array deduplication 1 Double-la...
This article describes the sql_mode mode in MySQL...
1. Image formats supported on the WEB: GIF: can s...
Preface We already know that MySQL uses the SQL S...