Support ongoing development - donate to help us maintain and improve the platform. 🖥️ Support sqltest →
SQL code copied to buffer
Task 48:

Name Popularity Classification

PostgreSQL
Analyze passenger data to classify first names by popularity. The passenger_name column in the tickets table contains full names with first and last name divided by a space.
Extract the passenger's first names, count the occurrences of each first name and classify names into 3 popularity groups: Most Popular, Moderately Popular, and Least Popular

Output results in the table with next columns:
- first_name - extracted first name in uppercase
- occurrences_count - number of the name occurrences
- popularity - popularity classification (Most Popular, Moderately Popular, or Least Popular)
sorted by popularity count (descending), then by first name (alphabetically).
Expected result Columns: 3 · Rows: 363
first_name occurrences_count popularity

Sample rows open after wrong checks: 0 of 3

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

Hi! Could we please enable some services and cookies to improve your experience and our website?

Privacy & Cookie Policy.