🎯 Few days left this month Support SQLTest.online and help us keep SQL practice free for everyone. Donate today →
SQL code copied to buffer
Task 203:

Rank Penguins by Body Mass

SQLite
You're analyzing data from a study on penguins and need to divide them into three equally sized groups based on their body mass.

Write an SQL query that selects the species, island, and body_mass_g for each penguin from the little_penguins table. Additionally, add a new column named body_mass_class that assigns each penguin to one of three groups (terciles) based on their body_mass_g, with the lightest penguins in group 1 and the heaviest in group 3.
Expected result Columns: 4 · Rows: 10
species island body_mass_g body_mass_class

Sample rows open after wrong checks: 0 of 2

Write your query below and click "Check it!". Tables are described in the right pane.

Tutorial
The query result will appear here. Ctrl+Enter - Run query