Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use functions in MySQL8 Database

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Xiaobian to share with you how to use MySQL8 database functions, I believe most people still do not know how to use, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

Use of built-in functions in databases

This article mainly introduces the use of built-in functions in the database, mainly date functions, string functions, mathematical functions.

(a) Date function

select current_date();//Get the current date, select current_time();//Get the current time, select current_timestamp();//Get the current date, select current_timestamp();//Get the current date, select current_timestamp ()('2017 -10- 28');//get parameter date select date_add ('2017 -10- 28', interval 10 day);//add the specified year/month/day to the parameter date select date_sub ('2017 -10- 28', interval 10 day);//select datediff ('2017 -10- 10','2016-9- 1') by subtracting the specified year/month/day from the parameter date;//calculates the number of days between two dates

(ii) String functions

3) Mathematical functions

other functions

user() Query the current user

md5(str) md5 digests a string to get a 32-bit string

database() Displays the database currently in use

password() function, which MySQL databases use to encrypt users

ifnull (val1, val2) returns val2 if val1 is null, otherwise returns val1's value

//user() queries the current user select user(); //md5(str) md5 digests a string to get a 32-bit string select md5 ('admin ') //database() displays the database currently in use select database(); //password() function, MySQL database uses this function to encrypt the user select password ('root');//ifnull (val1, val2) If val1 is null, return val2, otherwise return val1's value select ifnull ('abc ', ' 123');//abc is not empty at this time, so return abc above is "MySQL8 database function how to use" All the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report