Sunday, July 8, 2012

SQL Server 2012 Build-In Functions


Function
AVG
Description
Calculates the average of the Values in a Group.
Syntax
AVG (<>)
Optional
ALL  OR DISTINCT keyword can be used before the <> to get Average based on all values or Distinct values
Example
Select AVG(Math_Marks) From StudentMarks Group By Sections


Function
COUNT
Description
Gives no of items in a group
Syntax
COUNT (<>/ *)
Optional
ALL  OR DISTINCT keyword can be used before the <> to get count of all values or Distinct values
Example
Select Count(Student) From StudentMarks Group By Sections

No comments: