Home > Database > Mysql Tutorial > How to sum fields in mysql

How to sum fields in mysql

WBOY
Release: 2022-01-12 11:38:31
Original
7675 people have browsed it

In mysql, you can use the sum() function to sum fields. The function of this function is to return the total number of numerical columns. The syntax is "SELECT sum (evaluated field) FROM 'table name'".

How to sum fields in mysql

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How does mysql sum fields

In mysql, if you want to sum fields, you need to use the sum function.

The SUM() function returns the total number of numeric columns.

The syntax is as follows:

SELECT SUM(column_name) FROM table_name;
Copy after login

The example is as follows:

How to sum fields in mysql

##Sum command

mysql> select SUM(price) from order where create_time>'2016-03-12';
+------------+
| SUM(price) |
+------------+
| 37.40 |
+------------+
1 row in set
Copy after login
Recommended learning:

mysql video tutorial

The above is the detailed content of How to sum fields in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template