SUM() function in SQL Server

Sum():- This function is used to get the sum of values of the specified numeric column.


 Select Sum (column_name) from tablename


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)

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A005′,’Avinash’, ‘Dubey’,’’,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



About vivekjohari

Database Consultant with more than 11.5 years of experience in database designing & programming and DBA related activities.  Had good experience on different databases like SQL Server, MySQL & Oracle, Azure SQL &  Big Data.
This entry was posted in SQL Functions, SQL Server and tagged . Bookmark the permalink.

31 Responses to SUM() function in SQL Server

  1. Pingback: w88 club

  2. Pingback: w88

  3. Pingback: murat fedakar dolandirici

  4. Pingback: low doc home loans

  5. Pingback: United Medicare Advisors

  6. Pingback: cryptocurrencies

  7. Pingback: Bundles Wigs Weaves

  8. Pingback: jaguarqq

  9. Pingback: w888

  10. Pingback: didi promo code

  11. Pingback: Creative Agency in Orlando

  12. Pingback:

  13. Pingback:

  14. Pingback: w88th

  15. Pingback: custom cornhole board set

  16. Pingback: Darknet Drogen

  17. Pingback: Samsara Market

  18. Pingback: Samsara Market

  19. Pingback: Slager hengelo

  20. Pingback: huong dan choi ca do bong da online

  21. Pingback: Sea Games 2019

  22. Pingback: megapoker99

  23. Pingback: w88 casino online

  24. Pingback:

  25. Pingback: Leif

  26. Pingback: poker 99

  27. Pingback: tilecacuoc

  28. Pingback: data sgp

  29. Pingback: huong dan dang ky fun88

  30. Pingback: fowling rules

  31. KADİR says:

    hello thank you 🙂

Leave a Reply