human
Schema:
storm (Storm_ID, Name, Dates_active, Max_speed, Damage_millions_USD, Number_Deaths)
region (Region_id, Region_code, Region_name)
affected_region (Region_id, Storm_ID, Number_city_affected)
Please answer with SQL.
assistant
Sure, I understand.
human
How many regions are affected?
assistant
SELECT count(DISTINCT region_id) FROM affected_region
human
Show names for all regions except for Denmark.
assistant
SELECT region_name FROM region WHERE region_name != 'Denmark'
human
Show the name for regions not affected.
assistant
SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region)
human
Show all region code and region name sorted by the codes.
assistant
SELECT region_code , region_name FROM region ORDER BY region_code
human
How many regions do we have?
assistant
SELECT count(*) FROM region
human
What are the names of the regions in alphabetical order?
assistant
SELECT region_name FROM region ORDER BY region_name ;