Syntax:-
Select Sum (column_name) from tablename
Example:-
In this article, we are going to use the following table for the examples:-
CREATE TABLE [dbo]. [Employee](
[Empid] [Int] IDENTITY (1, 1) NOT NULL Primary key,
[EmpNumber] [nvarchar](50) NOT NULL,
[EmpFirstName] [nvarchar](150) NOT NULL,
[EmpLAStName] [nvarchar](150) NULL,
[EmpEmail] [nvarchar](150) NULL,
[Salary] [int] NULL
)
We insert following data into the above tables:-
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A001′,’Vivek’,’Johari’,’samir@abcmail.com’,200000)
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A002′,’Abhinav’,’Golwalkar’,’abhinav@abcmail.com’,100000)
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A003′,’Neha’,’Sharma’,’neha@abcmail.com’,300000)
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A004′,’Chandra’,’Singh’,’vivek@abcmail.com’,320000)
Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A005′,’Avinash’, ‘Dubey’,’avinash@abcmail.com’,250000)
For example, query for finding the total amount of salary given by the company to its employee is given below:-
Select sum (salary) from Employee
Result
1170000
Pingback: w88 club
Pingback: w88
Pingback: murat fedakar dolandirici
Pingback: low doc home loans
Pingback: United Medicare Advisors
Pingback: cryptocurrencies
Pingback: Bundles Wigs Weaves
Pingback: jaguarqq
Pingback: w888
Pingback: didi promo code
Pingback: Creative Agency in Orlando
Pingback: EmpireMarket-Links.com
Pingback: https://www.olx.pl/
Pingback: w88th
Pingback: custom cornhole board set
Pingback: Darknet Drogen
Pingback: Samsara Market
Pingback: Samsara Market
Pingback: Slager hengelo
Pingback: huong dan choi ca do bong da online
Pingback: Sea Games 2019
Pingback: megapoker99
Pingback: w88 casino online
Pingback: granice.info
Pingback: Leif
Pingback: poker 99
Pingback: tilecacuoc
Pingback: data sgp
Pingback: huong dan dang ky fun88
Pingback: fowling rules
hello thank you 🙂