Challenge: Calculate Percentage Growth
Aufgabe
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.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 6
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Suggested prompts:
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Großartig!
Completion Rate verbessert auf 4.55
Challenge: Calculate Percentage Growth
Swipe um das Menü anzuzeigen
Aufgabe
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.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 6
single