Search⌘ K

Challenge: Create a Histogram

Explore how to write SQL queries in PostgreSQL to create a histogram representing earthquake aftershock magnitudes and their frequencies. This lesson helps you practice generating textual histograms directly in the database, enhancing your ability to analyze and visualize data distributions using SQL.

Problem statement

The most common measure of an earthquake’s size is magnitude. The data based on the magnitude of the aftershocks of an earthquake is given below:

Magnitude: 4.1, 4.2, 4.3, ...