Get the App
SLTechnology News&Howtos  ›  Database  › 

How to sum fields by mysql

Shulou Source: shulou.com Published: 2022-05-31 11:40:27 11月12日 Update

This article mainly shows you "mysql how to sum fields", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "mysql how to sum fields" this article.

In mysql, you can use the sum () function to sum fields, which returns the total number of numeric columns with the syntax "SELECT sum (evaluated field) FROM 'table name".

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

How to sum fields by mysql

In mysql, if you want to sum fields, you need to take advantage of 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

Examples are as follows:

Summation command

Mysql > select SUM (price) from order where create_time > '2016-03-12 row in set + | SUM (price) | +-+ | 37.40 | +-+ 1 row in set is all the content of this article "how to sum fields in mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Fields functions content articles totals numeric values grammar learning help functions commands that is tutorials easy to understand more organization version environment computer knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL Apple Shulou Information NVidia