Task 2: Find Cities With Minimal Shelters

#2 · 2 of 10Free sample
Question

Task 2: Find Cities With Minimal Shelters

Retrieve city_id, city_name, and shelters_available for the 5 cities with the fewest shelters, ordered by shelters_available in ascending order.
Tables
6 tables · 28 columns
aliens4 cols
  • alien_idINTEGER
  • species_nameTEXT
  • home_planetTEXT
  • threat_levelTEXT
cities5 cols
  • city_idINTEGER
  • city_nameTEXT
  • populationINTEGER
  • shelters_availableINTEGER
  • defense_levelINTEGER
resources4 cols
  • resource_idINTEGER
  • city_idINTEGER
  • resource_nameTEXT
  • quantityINTEGER
defenses4 cols
  • defense_idINTEGER
  • city_idINTEGER
  • defense_nameTEXT
  • power_levelINTEGER
alien_ship_movements5 cols
  • movement_idINTEGER
  • alien_idINTEGER
  • city_idINTEGER
  • departure_dateTEXT
  • arrival_dateTEXT
attacks6 cols
  • attack_idINTEGER
  • alien_idINTEGER
  • city_idINTEGER
  • attack_dateTEXT
  • damage_levelTEXT
  • casualtiesINTEGER
Loading the practice editor and dataset…
Your answer(autosaved)
query.sql
Loading editor…
Sign up to unlock

The reference answer is one click away.

Free account unlocks the reference answer, the explanation, and the GPT tutor on every exercise in the library.

  • Reference answer + explanation revealed after each attempt
  • GPT tutor for every problem
  • Progress saved on the platform
  • 1,598 graded exercises
  • Free forever — no credit card
All exercises in SQL Alien Invasion Challenge: Defend Earth