Articles → SQL SERVER → Aggregate Functions In SQL Server

Aggregate Functions In SQL Server







  1. Sum
  2. Avg
  3. Max
  4. Count



Student, Subject and Marks tables


Student_IDStudent_Name
1Karan
2Sumit
3Ashish


Subject_IDSubject_Name
1Mathematics
2Social Studies
3General Science


Primary_Key_IDStudent_IDSubject_IDMarks
11185
21265
31360



Sum


select sum(Marks) from Marks where Student_ID = 1





Avg


select avg(Marks) from Marks where Student_ID = 1





Max


select max(Marks) from Marks where Student_ID = 1





Count


select count(*) from department where Student_ID = 1





Posted By  -  Karan Gupta
 
Posted On  -  Monday, March 29, 2010

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250