MySQL Addition returns you the sum value of the total counts in a table. The Aggregate function is used to perform the calculation in SQL Query.

Tutorials

MySQL Addition returns you the sum value of the total counts in a table. The Aggregate function is used to perform the calculation in SQL Query. We make use of Aggregate function with group by and order by.

Understand with Example

The Tutorial illustrate an example from 'MySQL Addition'. To understand the example we have a table employee in the database. The select order by query is used to sort the records by specific column. In this example we sorts the records of name and salary on the basis of salary column from table 'employee'.

 `Query` `select name, salary from employee order by salary;` `Output` ```+------------------------+--------+ | name | salary | +------------------------+--------+ | Miss.hardeep | 5000 | | Mr.komal choudhary | 5000 | | Mr.girish tewari | 5000 | | Mr.sandeep kumar suman | 6000 | | Mr.govind | 6000 | | Mr.vineet bansal | 6000 | | Miss.anusmita | 6000 | | Mr.amit raghuvanshi | 6000 | | Mr.santosh kashyap | 7500 | | Mr.amardeep patel | 8000 | | Mr.vikash | 8500 | | Mr.vinod kumar | 8500 | | Mr.ravi kant | 10000 | | Mr.rakesh | 12000 | | Mr.noor | 13500 | | Mr.deepak mohanty | 15000 | | Mr.vimlaksha gautam | 15000 | | Mr.suman saurabh | 17000 | +------------------------+--------+```

In this example the sum keyword is used to calculate the salary of employee in a table 'employee'.

 `Query` ` select sum(salary) from employee;` `Output` ```+-------------+ | sum(salary) | +-------------+ | 160000 | +-------------+```

### Online Training Classes - 50% off on all classes for today

Related Tutorials