Joining to get total sales, a SQL problem

Joining to get total sales, a SQL problem
SQL Database Querying

Suppose you work for a retail company that has a database containing two tables, one called 'orders', and one called 'revenue', as shown below:

Orders:

order_id channel date month
0 1 Online 2018-09-01 September
1 2 Online 2018-09-03 September
2 3 In_store 2018-10-11 October
3 4 In_store 2018-08-21 August
4 5 Online 2018-08-13 August
5 6 Online 2018-10-29 October

Revenue:

order_id revenue
0 1 100
1 2 125
2 3 200
3 4 80
4 5 200
5 6 100

Using SQL, write a query to show the total revenue by channel for the months of September and October. Additionally, try to think of the most efficient way to run this query.




Want the solutions? Upgrade to premium to access detailed solutions to each problem (including this one).

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


Unsubscribe

Older messages

Formatting dirty data

Friday, October 9, 2020

Data Interview Qs Formatting dirty data Data Analysis Python Pandas Data Manipulation Suppose you have the following dataset which contains which contains (1st tab) a list of items purchased by a given

The carshare dilemma

Wednesday, October 7, 2020

Data Interview Qs The carshare dilemma Statistics Probability Theory Suppose we have selected a group of people to take a survey. 35% of the group like Uber, 20% like both Lyft and Uber, and 25% like

Predicting churn with a decision tree

Monday, October 5, 2020

Data Interview Qs Predicting churn with a decision tree Python Product Metrics Pandas Data Analysis External Dataset Machine Learning Classifers Decision Tree Given the following dataset, can you

Tallying up absent students using SQL

Friday, October 2, 2020

Data Interview Qs Tallying up absent students using SQL SQL Database Querying Given the following table schemas, pull a list of students with the most absences in descending order. You can filter out

Data Interview Questions: Problem #76

Wednesday, September 30, 2020

Data Interview Qs The Weather Report Data Analysis Python Pandas Data Manipulation Data Visualization External Dataset Suppose you have the following dataset, which contains information about a

You Might Also Like

80% Off iPhone Photo Academy!

Monday, May 6, 2024

Hi there, Are you ready to dramatically improve your iPhone photography skills? We all know that the iPhone camera is extremely powerful, but most of us still manage to take a lot of photos that aren

Architecture Weekly #178 - 6th May 2024

Monday, May 6, 2024

This time, we discussed biases. Biases on the perspective on our technologies, so not seeing their evolutions. We also checked how biases can impact our knowledge, collaboration and eventually also the

WP Weekly 192 - WP Biz - Brands Merged, Woo Cart Popup, Fastest Hosting

Monday, May 6, 2024

Read on Website WP Weekly 192 / WP Biz The 'business of WordPress' is buzzing for sure, be it the acquisition of plugins or the massive Envato ownership change. Also, WordPress content brands

SRE Weekly Issue #423

Monday, May 6, 2024

View on sreweekly.com A message from our sponsor, FireHydrant: FireHydrant is now AI-powered for faster, smarter incidents! Power up your incidents with auto-generated real-time summaries,

⚠️ Avoiding AI Scams on Social Media — An Open Source Google Photos Alternative

Sunday, May 5, 2024

Also: Reviewing the Customizable Drop Mechanical Keyboard, and More! How-To Geek Logo May 5, 2024 📩 Get expert reviews, the hottest deals, how-to's, breaking news, and more delivered directly to

Daily Coding Problem: Problem #1432 [Medium]

Sunday, May 5, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This question was asked by Snapchat. Given the head to a singly linked list, where each node also has a “random”

PD#572 Good Ideas in Computer Science

Sunday, May 5, 2024

Ideas every programmer likes and why Garbage Collection and Object Oriented Programming don't count ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

RD#454 API Layer & Fetch Functions

Sunday, May 5, 2024

ixing API and UI code quickly leads to messy and unmaintainable code ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

The Shiny Toy Syndrome & Tiny macOS utility apps I love

Sunday, May 5, 2024

Lex launching its redesign, Raycast shares another monthly update packed with AI updates, prompts should be designed not engineered, and a lot more in this week's issue of Creativerly. Creativerly

Hyundai antes up $1B for AV startup Motional and Elon unplugs the Tesla Supercharger team

Sunday, May 5, 2024

Plus, layoffs come for Luminar, Fisker and Ola View this email online in your browser By Kirsten Korosec Sunday, May 5, 2024 Image Credits: Motional Welcome back to TechCrunch Mobility — your central