Q#3: Chocolate Bar Reviews

You have the following dataset of chocolate bar ratings. You can assume you have this data in a table called InternationalChocolateRatings.

Can you write a SQL query to summarize the BroadBeanOrigin for US manufactured chocolate bars and provide the number of reviews, average rating, and average cocoa percent?

ANSWER:

SELECT COUNT(ReviewDate) as Number_of_Reviews, AVG(Rating) as Average_Rating, AVG(CocoaPercent) as Average_Cocoa_Percent 
FROM InternationalChocolateRatings;

--

--

--

Data Science tutorial working through solutions to Data Science Interview Questions

Recommended from Medium

Which Language Do You Use at Work?

General Setup for Data Science Projects in Python with macOS Big Sur

Python written in VSCode

Cox Proportional Hazard Model

Exploratory Data Analysis

The Dark Side of Data Science | Data Mobs — The Analytical Trends.

Building a Stock Screener (for free) in Python

Measuring a Crop’s ROI

Estimating momentarily creativity using word embeddings

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abish Pius

Abish Pius

Data Science Professional who teaches with unflashy, simple to understand python code.

More from Medium

02. One SQL A Day (17/06/22)

Ease into SQL

5 Advance SQL functions you must know

Master SQL Queries (in 5 minutes)