while suming all salaries why we are not using asterisk * | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

while suming all salaries why we are not using asterisk *

21st Aug 2016, 9:13 AM
vicky manhotra
vicky manhotra - avatar
2 Answers
+ 2
you have a table like name-salary a-34 b-39 c-65 if you use * then all column will be selected. but you can't sum name because it's char .you only sum integer so you need to use sum(salary) which only select salary and sum up it
22nd Aug 2016, 6:27 AM
Raton Kumar
Raton Kumar - avatar
+ 1
In sql '*' means all. But when you want to sum all salaries you need an arithmetic operator, without an arithmetic operator how can you sum all salaries in general mathematics. But in sql you just need an function which will perform same as that arithmetic operator to produce summation of given numbers and the function is SUM. and the syntax is: SELECT SUM('salaries')FROM employees;
21st Aug 2016, 6:28 PM
Dipayan Pramanik
Dipayan Pramanik - avatar