← ALL CHALLENGES
CHALLENGE / INTERMEDIATE / READY TO QUERY

ประเทศรายได้สูงมีนักท่องเที่ยวมากกว่าเสมอไหม?

ฝึก JOIN ข้อมูลนักท่องเที่ยวต่างชาติกับ GDP ต่อหัว แล้วเปรียบเทียบประเทศในปีเดียวกัน

01 / THE QUESTION

Question

ประเทศที่มี GDP ต่อหัวสูงได้รับนักท่องเที่ยวต่างชาติมากกว่าเสมอหรือไม่? ลองหาประเทศที่ไม่เป็นไปตามแนวโน้มในปีเดียวกัน

02 / SOURCE TABLES

Tables to use

03 / RELATIONSHIP

ER diagram

ONE TO ONE RELATIONSHIP
worldbank_international_tourist_arrivalscountry_iso_alpha3Key fieldyearKey fieldinternational_tourist_arrivals
worldbank_gdp_per_capitacountry_iso_alpha3Join fieldyearJoin fieldgdp_per_capita_current_usd

worldbank_international_tourist_arrivals.country_iso_alpha3 = worldbank_gdp_per_capita.country_iso_alpha3 + year · one tourism observation to one GDP-per-capita observation for each country and year

04 / ANALYST GUIDE

Guide

Analysis requirements

  • เชื่อมข้อมูลด้วย country_iso_alpha3 และ year แล้วเลือกค่าที่ไม่เป็น null ในปี 2019
  • แสดงทั้งจำนวนการเดินทางเข้าและ GDP ต่อหัว เพื่อตรวจหาค่าที่สูง ต่ำ หรือแตกต่างจากกลุ่ม
  • จำนวนการเดินทางเข้าขึ้นอยู่กับหลายปัจจัย การเปรียบเทียบนี้จึงไม่ได้พิสูจน์ว่าสิ่งหนึ่งเป็นสาเหตุของอีกสิ่ง

Suggested query

Expand suggested query
SQL / STARTER QUERY
SELECT t.country_iso_alpha3, t.country_name, t.year,
       t.international_tourist_arrivals, g.gdp_per_capita_current_usd
FROM worldbank_international_tourist_arrivals AS t
JOIN worldbank_gdp_per_capita AS g
  ON t.country_iso_alpha3 = g.country_iso_alpha3
 AND t.year = g.year
WHERE t.year = 2019
  AND t.international_tourist_arrivals IS NOT NULL
  AND g.gdp_per_capita_current_usd IS NOT NULL
ORDER BY g.gdp_per_capita_current_usd DESC;