Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
3.1. COUNT, SUM, AVG, MAX, MIN
This section
Practice test
12 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
5 cards from this lesson. Good the night before a test.
Try these first
- 1.
What SQL function would you use to count the number of users?
Hint
Think of how we track the number of entries in a dataset.
- 2.
How would you aggregate the total sales from a table?
Hint
Consider what you're adding up.
- 3.
What does the AVG function calculate?
- Total of values
- Lowest value
- Average of values
Hint
Think about how you would find the average score.
- 4.
True or False: The COUNT function can return 0 if no rows meet the condition.
- True
- False
Hint
Consider what happens when there are no results.
- 5.
Write a complex SQL query that retrieves departments with an average salary above the total average salary and shows the maximum salary within each department.
Hint
You'll need to use subqueries to compare average salaries.
- 6.
Using a sales data table, create a query to find products whose total sales exceed the average sales of all products and list them.
Hint
Think about how you would aggregate and compare the totals.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
2 more questions available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting