Challenge: Calculate Percentage Growth
Tarefa
Swipe to start coding
Write a SQL query to calculate the percentage growth in revenue for each month compared to the previous month.
- Group the
revenuetable by month and sum theamountfor each month. - Use a window function to access the previous month's total revenue for each row.
- Calculate the percentage growth as the difference between the current and previous month's revenue divided by the previous month's revenue, multiplied by 100.
- Handle cases where the previous month's revenue is
NULLor zero by returningNULLfor the percentage growth.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 2. Capítulo 6
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Incrível!
Completion taxa melhorada para 4.55
Challenge: Calculate Percentage Growth
Deslize para mostrar o menu
Tarefa
Swipe to start coding
Write a SQL query to calculate the percentage growth in revenue for each month compared to the previous month.
- Group the
revenuetable by month and sum theamountfor each month. - Use a window function to access the previous month's total revenue for each row.
- Calculate the percentage growth as the difference between the current and previous month's revenue divided by the previous month's revenue, multiplied by 100.
- Handle cases where the previous month's revenue is
NULLor zero by returningNULLfor the percentage growth.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 2. Capítulo 6
single