Data Interview Qs - Calculating monthly sales growth in SQL

InterviewQs

Calculating monthly sales growth in SQL

SQL Database Querying Lag Function Window Function

Forward this email to a friend or colleague and challenge them to solve it.

Given the table below, called 'sales', can you write a SQL query to show the monthly sales growth by channel? To calculate the monthly sales growth, you can apply the following logic:

sales growth = (current month's sales - prior month's sales) / prior month's sales

order_id channel date month sales_total
1 online 2018-09-01 09 100
2 online 2018-09-03 09 125
3 in_store 2018-10-11 10 200
4 in_store 2018-08-21 08 80
5 online 2018-08-13 08 200


 

Congratulations! You’ve accumulated 145 questions since joining our email list. Create a premium account to access detailed solutions to each problem (including this one) + our new Case studies.


Was this email forwarded to you? You can join our list here to receive questions

How did you like today's question?

15411 Boischatel, Montreal, QC, H9H1Y7, Canada
Don't want to get these emails anymore? We'll forgive you if you unsubscribe

Older messages

Chipotle total revenue per item

Friday, June 4, 2021

Data Analysis, Python, Pandas, Data Manipulation, Data Visualization, External Dataset, InterviewQs Chipotle total revenue per item Data Analysis Python Pandas Data Manipulation Data Visualization

Rainy flights

Wednesday, June 2, 2021

Statistics, Probability Theory, Conditional Probability, InterviewQs Rainy flights Statistics Probability Theory Conditional Probability Forward this email to a friend or colleague and challenge them

Temperature conversion

Monday, May 31, 2021

Python, Algorithms, InterviewQs Temperature conversion Python Algorithms Forward this email to a friend or colleague and challenge them to solve it. Write a Python function to convert temperatures from

Days to first sale

Friday, May 28, 2021

SQL, Database Querying, Percentiles, Min, InterviewQs Days to first sale SQL Database Querying Percentiles Min Forward this email to a friend or colleague and challenge them to solve it. You're

Marketing attribution

Wednesday, May 26, 2021

Data Analysis, Python, Pandas, Data Manipulation, External Dataset, InterviewQs Marketing attribution Data Analysis Python Pandas Data Manipulation External Dataset New Feature: We've added 5

You Might Also Like

Rapidly responsive... space stations!?

Monday, April 29, 2024

There are scant details as to the mission profile, but I can't help but feel intrigued by this news from Gravitics View this email online in your browser By Aria Alamalhodaei Monday, April 29, 2024

Daily Coding Problem: Problem #1426 [Hard]

Monday, April 29, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Salesforce. Given an array of integers, find the maximum XOR of any two elements.

Code Story - Mar 24

Monday, April 29, 2024

Welcome to the March addition of the podcast newsletter. Please enjoy, and check out any of the episodes you might have missed below. ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Feature | The Best Visualizations from April on Our New App 📲

Monday, April 29, 2024

See the most popular, most discussed, and most liked visualizations on our new data storytelling app Voronoi from April. View Online | Subscribe At the end of 2023, we publicly launched Voronoi, our

😸 Tangible change

Monday, April 29, 2024

🤖 Elon is closing in on $6 billion in funding for his AI startup. 🛜 The FCC has officially voted... Product Hunt Read in browser This newsletter is brought to you by YOU MIGHT HAVE MISSED 🤖 Elon is

⚙️ AI has emotions now

Monday, April 29, 2024

Plus: Meta AI? More like Mid-ta AI! ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

Yikes! Copilot failed all our coding tests

Monday, April 29, 2024

iPad Pro with M4; Best security keys; AI conducts job interviews now -- ZDNET ZDNET Tech Today - US April 29, 2024 placeholder Yikes! Microsoft Copilot failed every single one of my coding tests I ran

Re: The smart home product I use every day!

Monday, April 29, 2024

Hey , Earlier this month, I emailed you about one of my favorite smart home products, a robot vacuum and mop. I wanted to let you know that Samsung currently has a Spring Black Friday Sale and is

The EU draws its regulatory cords tighter around Apple

Monday, April 29, 2024

The EU has said Apple's iPadOS will now fall under the DMA View this email online in your browser By Alex Wilhelm Monday, April 29, 2024 Welcome to TechCrunch AM! We're off to a quick start

GCP Newsletter #396

Monday, April 29, 2024

Welcome to issue #396 April 29th, 2024 News Networking Official Blog Partners Introducing the Verified Peering Provider program, a simple alternative to Direct Peering - Google has launched a new