Data Interview Qs - Avg. sales by location in SQL
Avg. sales by location in SQL
SQL Database Querying
You are given the below tables, showing Store, Product, and Sales information for a chain of grocery stores. The columns are labeled in such a way that you should be able to interpret what each field is showing.
Store
store_id | location |
91110 | New York |
99525 | Los Angeles |
37340 | Tokyo |
32016 | Detroit |
57507 | London |
Product
product_id | product_name | price_usd |
31331 | Apples | 2 |
34611 | Lettuce | 3 |
49760 | Chicken | 5 |
26583 | Lemons | 1 |
20267 | Bread | 2 |
Sales
sale_id | product_id | store_id | date |
1 | 31331 | 91110 | 02/20/2020 |
1 | 31331 | 91110 | 02/20/2020 |
2 | 34611 | 57507 | 02/20/2020 |
3 | 26583 | 37340 | 02/20/2020 |
3 | 34611 | 32016 | 02/20/2020 |
3 | 20267 | 99525 | 02/21/2020 |
4 | 31331 | 99525 | 02/21/2020 |
5 | 49760 | 99525 | 02/21/2020 |
6 | 34611 | 57507 | 02/21/2020 |
7 | 31331 | 91110 | 02/21/2020 |
Using the tables above, write a SQL query to return the number of sales as well as the average sale price (in dollars) for a given location.
Your output should return the following columns:
location | number_sales | avg_sale_price |
X | Y | Z |
A | B | C |
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
Cleaning and analyzing employee data
Friday, January 15, 2021
Data Interview Qs Cleaning and analyzing employee data Data Analysis Python Pandas Data Manipulation Data Cleaning Below is a snippet from a table that contains information about employees that work at
Life expectancy
Monday, January 11, 2021
Data Interview Qs Life expectancy Statistics Probability Theory Conditional Probability Suppose you're analyzing a population of 100000 people, and you're trying to understand life expectancy.
Counting numbers, letters, and other things from a text file
Friday, January 8, 2021
Data Interview Qs Counting numbers, letters, and other things from a text file Python Reading Files Write a function that can take in a text file and return the number of characters in the file
Calculating quarterly moving average of revenue in SQL
Wednesday, January 6, 2021
Data Interview Qs Calculating quarterly moving average of revenue in SQL SQL Database Querying Window Function Moving Average Suppose you're working with a large conglomerate and are trying to
Best ad group
Monday, January 4, 2021
Data Interview Qs Best ad group Data Analysis Python Pandas Data Manipulation External Dataset Given the following dataset, can you identify the top 3 performing ad groups? Explain how you evaluated
You Might Also Like
Tuesday Triage #200 and giveaway
Tuesday, May 14, 2024
Your weekly crème de la crème of the Internet is here! The 200th edition featuring annual subscriptions giveaway, thoughts on nearly four years of ...
🎮 How AI Tools Are Changing Game Development — Grab a Pixel 8a Instead of Waiting for Pixel 9
Tuesday, May 14, 2024
Also: Sharing Your Google Maps Trip Progress, and More! How-To Geek Logo May 14, 2024 Did You Know In a bid to keep the ingredients secret, WD-40 was never patented. 🤖 The New GPT It's Tuesday!
Meta shuts down Workplace
Tuesday, May 14, 2024
Plus: Everything that happened at Google I/O and AWS CEO steps down View this email online in your browser By Christine Hall Tuesday, May 14, 2024 Hello, and welcome back to TechCrunch PM. The team
Flattening Lists of Lists, Python 3.13, Sets, and More
Tuesday, May 14, 2024
Flattening a List of Lists in Python #629 – MAY 14, 2024 VIEW IN BROWSER The PyCoder's Weekly Logo Flattening a List of Lists in Python In this video course, you'll learn how to flatten a list
Daily Coding Problem: Problem #1441 [Easy]
Tuesday, May 14, 2024
Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Google. UTF-8 is a character encoding that maps each symbol to one, two, three, or four
Noonification: 3 Quick Ways to Optimize RecyclerView
Tuesday, May 14, 2024
Top Tech Content sent at Noon! Get Algolia: AI Search that understands How are you, @newsletterest1? 🪐 What's happening in tech today, May 14, 2024? The HackerNoon Newsletter brings the HackerNoon
Using 97 fewer cores thanks to PGO
Tuesday, May 14, 2024
Plus an HNSW indexed vector store library, a new Go game hits the Steam store, and is 'ok' ok?. | #507 — May 14, 2024 Unsub | Web Version Together with Stytch logo Go Weekly Reclaiming CPU for
Ranked | The Top 6 Economies by Share of Global GDP (1980-2024) 📈
Tuesday, May 14, 2024
Gain a unique perspective on the world's economic order from this graphic showing percentage share of global GDP over time. View Online | Subscribe Presented by: Data that drives the
Free online event this Thursday: Getting ahead with time series data
Tuesday, May 14, 2024
Free Online Event Do you know how your competitors use time series data to get ahead? Join us on Thursday, May 16 at 10am PT/1pm ET for a free, hour-long online fireside chat called “Unleash the Full
Here's the deal
Tuesday, May 14, 2024
We wanted you to be among the first to know about our plans to relaunch the Gigantic training courses that Product Collective now powers! Here's the deal: From May 20th - May 31st, anybody that