Home  >  Article  >  Database  >  MySQL statistics sum Select Sum

MySQL statistics sum Select Sum

黄舟
黄舟Original
2016-12-27 17:35:113933browse

Sum of statistical data

SELECT SUM() FROM syntax is used to calculate the sum of statistical data from the data table.

Syntax:

SELECT SUM(column) FROM tb_name

This SQL syntax is used to count the sum of values ​​of a certain numerical type field. SUM() cannot contain multiple fields. Although string and other types can be executed, Meaningless.

Example:

SELECT SUM(uid) FROM user

Get query results:

10

Statistical maximum data

SELECT MAX() FROM syntax is used to extract data from the data table Count the maximum data of a certain field.

Syntax:

SELECT MAX(column) FROM tb_name

This SQL syntax is used to count the maximum value of a certain numerical type field. There cannot be multiple fields in MAX().

Example:

SELECT MAX(uid) FROM user

Get the query results:

4

The above is the content of the MySQL statistical data and Select Sum. For more related content, please pay attention to the PHP Chinese website (www. php.cn)!


Statement:
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