Locked lesson.
About this lesson
We will look at some built in functions for performing calculations on data
Exercise files
Download this lesson’s related exercise files.
Functions.docx58.9 KB Functions - Solution.docx
59.5 KB
Quick reference
Functions
SQL has lots of built in functions that let us calculate data.
When to use
We'll look at Count, Average, and Sum in this video.
Instructions
To Count:
SELECT COUNT([Age])
FROM [Customer].[dbo].[Current_Customers]
To Average:
SELECT AVG([Age])
FROM [Customer].[dbo].[Current_Customers]
To Sum:
SELECT SUM([Age])
FROM [Customer].[dbo].[Current_Customers]
Hints & tips
- You can do basic math in a select statement (SELECT 2 + 3)
- COUNT(Age)
- AVG(Age)
- SUM(Age)
Lesson notes are only available for subscribers.