MySQL Common Functions1. Numeric FunctionsAdditional: ceil(x) For example, if ceil(1.23) has a value of 2, it can be written as ceiling(x) String functionsThe dash is commonly used (to get the number of bytes) Add: char_length character (query the last three digits of the name) For example: char_length(name)=3 can be written as: select left(name,1) from c1; 3. Time function
4. System FunctionTo add a separator: select concat_ws('#',name,tel,height) from xxb; select (substr(Now(),1,4)-substr(age,1,4) as agefrom zxc; Explanation of the following SQL statements: The first now() is used for comparison, interval 50 minute means pushing back 50 units, and -50 means pushing forward 50 units. year(now()) gets the year; month(now()) gets the month; day(now()) gets the day; nour(now()) gets the hour; minute(now()) gets the minute; second(now()) gets the second select now(),date_add(now(),interval 50 minute); Get the day of the week: select dayofweek(now()),dayname(now()); 5. Aggregation FunctionsAggregate multiple data to calculate a single data value usage: select sum(height) from c1; Get the number of records (number of rows), and filter out empty values: count() If there is one empty row in 14 rows, count() will be 13 rows. Count() can be accompanied by count(*) for more accuracy. Count(*) is generally used for statistics. Calculate the difference between two dates in multiple units, such as: select timestampdiff (time unit, date time 1, date time 2) written as: select timestampdiff(day,'2021-11-18','2021-11-22'); Thank you to everyone who read my article carefully! ! ! If the following materials are useful, you can take them directly: 1. Complete project source code and environment required for self-study development or testing 2. All templates in testing work (test plan, test case, test report, etc.) 3. Classic software testing interview questions 4. Python/Java Automation Testing Practice.pdf 5. Jmeter/postman interface test full set of video acquisition This is the end of this article on MySQL's detailed summary of commonly used functions. For more relevant MySQL commonly used functions, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Use ab tool to perform API stress test on the server
>>: Example of converting JS one-dimensional array into three-dimensional array
As shown in the figure: There are many files conne...
Table of contents Use of this.$set in Vue use Why...
Table of contents Node connects to Mysql Install ...
Table of contents Update the image from an existi...
Recently, some friends said that after installing...
If you want to become a Linux master, then master...
Table of contents 1. Basic use 2. Several points ...
Table of contents 1 Node.js method of sending ema...
This article uses examples to explain the concept...
Log in to your account export DOCKER_REGISTRY=reg...
Querying the database SELECT * FROM `student` Que...
Table of contents 1. The reason why the limit is ...
Three tables are connected. Field a of table A co...
/etc/fstab Automatically mount partitions/disks, ...
This article example shares the specific code of ...