❤️ Thank you to everyone who supported the project! Last month you donated almost $100 — this keeps the service running free for everyone this month. I hope to count on your support for next month too. Support now →
SQL code copied to buffer
RU PT FR
Task 48:

Passenger names classification

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).

Use PostgreSQL syntax to write your answer. Descriptions of tables are provided in the right pane.

Write your request in the field below and click the "Check it!" button.
Get hint
Copy code Clear editor

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

Privacy & Cookie Policy.