Data Interview Qs - eCommerce Margins

InterviewQs

eCommerce Margins

SQL Database Querying Rank Function Window Function

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

Hi, 

Suppose you're an analyst for an e-commerce store. You’re trying to identify the top selling items (by revenue) that have the highest margins. Using the tables below, can you write a SQL query that pulls the distributor, product_id, total revenue, total cost, total net margin, and number of units sold. Then, can you create additional columns that rank total net margin, total revenue, and total cost from greatest to least?


Table: allProducts

Column Name Data Type Description
product_id integer id of the product
product_name string name of the product
sku integer universal stockkeeping unit number
distributor_id integer unique id for distributor

Table: orders

Column Name Data Type Description
date string format is "YYYY-MM-DD"
user_id integer user id of purchaser
order_id integer unique order number
product_id integer id of product
no_units integer number of units sold in the order
sell_price integer the price the item is sold at
buy_price integer the price to procure the item
shipping_id integer id of shipping information
region string region of shipping id



 

You’ve accumulated 209 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

K-means cluster plot

Monday, November 1, 2021

Data Analysis, Python, Pandas, Data Manipulation, Data Visualization, K-means, Clustering, InterviewQs K-means cluster plot Data Analysis Python Pandas Data Manipulation Data Visualization K-means

Biased coin toss

Friday, October 29, 2021

Python, Statistics, Simulation, Probability Theory, InterviewQs Biased coin toss Python Statistics Simulation Probability Theory Forward this email to a friend or colleague and challenge them to solve

Counting the distance between words in Python

Wednesday, October 27, 2021

Python, String Manipulation, InterviewQs Counting the distance between words in Python Python String Manipulation Forward this email to a friend or colleague and challenge them to solve it. Hi, Suppose

Chocolate Bar Reviews

Monday, October 25, 2021

SQL, Database Querying, Rank Function, Window Function, External Dataset, InterviewQs Chocolate Bar Reviews SQL Database Querying Rank Function Window Function External Dataset Forward this email to a

Chipotle order prices

Friday, October 22, 2021

Data Analysis, Python, Pandas, Data Manipulation, External Dataset, InterviewQs Chipotle order prices Data Analysis Python Pandas Data Manipulation External Dataset Forward this email to a friend or

You Might Also Like

📧 Introduction to Distributed Tracing With OpenTelemetry in .NET

Saturday, April 20, 2024

​ Introduction to Distributed Tracing With OpenTelemetry in .NET Read on: m​y website / Read time: 5 minutes BROUGHT TO YOU BY ​ Shesha: The .NET Open-Source Low-Code Framework ​ Introducing Shesha, a

a16z’s Infrastructure team gets a new general partner

Friday, April 19, 2024

Post News is shutting down and Wall Street isn't feeling a Salesforce-Informatica pairing View this email online in your browser By Christine Hall Friday, April 19, 2024 Image Credits: Andreessen

New Roundtable! Additive for Mass Production Applications

Friday, April 19, 2024

The Outlook for the Future View this email in your browser engineering.com Roundtable - Additive for Mass Production Applications: The Outlook for the Future 6 Considerations for Choosing the Right

📷 What to Know About Macro Photography — Why You Should Buy a Budget Motherboard

Friday, April 19, 2024

Also: How to Automatically Highlight Values in Excel, and More! How-To Geek Logo April 19, 2024 📩 Get expert reviews, the hottest deals, how-to's, breaking news, and more delivered directly to your

Is the wind going out of the AI sails?

Friday, April 19, 2024

Rippling vacuums up venture capital and Ramp bags more millions View this email online in your browser By Haje Jan Kamps Friday, April 19, 2024 Image Credits: Getty Images / Carol Yepes Welcome to

Llama 3 is out - Weekly News Roundup - Issue #463

Friday, April 19, 2024

Plus: brand-new, all-electric Atlas; AI Index Report 2024; Microsoft pitched GenAI tools to US military; Humane AI Pin reviews are in; debunking Devin; and more! ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Daily Coding Problem: Problem #1417 [Easy]

Friday, April 19, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Wayfair. You are given a 2 x N board, and instructed to completely cover the board with

Charted | How Hard Is It to Get Into an Ivy League School? 🎓

Friday, April 19, 2024

We detail the admission rates and average annual cost for Ivy League schools, as well as the median SAT scores required to be accepted. View Online | Subscribe Presented by: Discover the motivations

Dark Matter & Tortured Poets

Friday, April 19, 2024

New music releases aren't what they used to be -- for good and bad. Dark Matter & Tortured Poets By MG Siegler • 19 Apr 2024 View in browser View in browser New music releases in 2024 are a

Impact of AI on Product Management

Friday, April 19, 2024

​ Impact of AI on Product Management The rise of the AI Product Manager. Product managers have always championed customer's needs. However, with AI, the job requires new technical and ethical