Menu

SQL Query for SUM


The SQL SUM() function is used to calculate sum of numbers.

SQL SUM() Syntax

SELECT SUM(column_name)
FROM table_name
WHERE condition;

SQL SUM() Example

In this example we calculate the average run of Virat kohili in 3 match.

MatchNo Name Run Wicket
1 Virat 78 1
2 Virat 82 2
3 Viart 50 0

SQL Query

SELECT SUM(Run)
FROM cricket_score;

Output

210








Connection failed: SQLSTATE[28000] [1045] Access denied for user 'studentdb'@'localhost' (using password: YES)

Subscribe