🔥 0
0
Lesson 6 of 6 15 min +250 XP

🧠 Window Functions Assessment

Answer all questions to complete the quiz and earn 250 XP.

1

You need to show each product's revenue AND its category's total revenue in the same row. Which approach is correct?

2

To find users who placed orders on consecutive days, which function helps?

3

Your sales team has 100 members. You want to identify the top 10% performers. Which function is most direct?

4

For a 30-day rolling sum of transactions per customer, which frame clause is correct?

5

RANK() gives 1,1,3 for three salespeople, but you want 1,1,2. Which function should you use?

6

This query fails: 'SELECT name, salary, AVG(salary) OVER () as avg_sal WHERE salary > avg_sal'. Why?

7

To get the first purchase date for each customer while keeping all their orders visible, use:

8

What's wrong with: LAST_VALUE(price) OVER (PARTITION BY category ORDER BY date)

9

Calculate month-over-month growth rate: (current - previous) / previous * 100. Which expression is correct?

10

You're paginating results: page 5 with 20 items per page. Which ROW_NUMBER range do you need?

11

Which is more efficient for 'top 3 per category' on a million-row table?

12

SUM(amount) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) is equivalent to:

13

Final question: Match the use case to the best window function. 'Remove duplicate entries keeping the most recent' uses: