🙏 We need your help! SQLtest.online has no ads and lives only on donations. Even a small amount helps. Donate now →
SQL code copied to buffer
Task 32:

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

By checking a query, you agree that it is stored without your account details and may be included in anonymized datasets, including for AI training. Learn more

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