π Exploring the World with SQL:
As someone passionate about data analysis, I wanted to challenge myself with a project that demonstrates real-world analytical thinking using SQL. For this, I turned to the classic world
database, a publicly available dataset containing information on countries, cities, and languages around the globe.
π The Challenge
How can we extract meaningful insights from raw geographic and demographic data using only SQL?
Rather than just running a few queries, I approached this like a mini data investigation β posing questions, framing them into SQL problems, and interpreting the answers. Each query became a stepping stone in understanding how to structure, filter, and join relational data.
π οΈ The Tools
MySQL for writing and executing SQL queries
world.sql database (city, country, and language tables)
π Key Insights Discovered
1. How many cities are listed in the USA?
β I learned how to count entries with WHERE
filters.
2. Which country has the highest life expectancy?
β Using ORDER BY
and LIMIT
, I quickly ranked all nations.
3. Which cities start with βBeβ?
β Pattern matching (LIKE 'Be%'
) revealed naming conventions across cultures.
4. What are the 10 most populous cities globally?
β This was a simple sort, but it gave context on urban population distribution.
5. Whatβs the average city population per country?
β Grouping and joining tables helped me spot countries with more urbanized populations.
6. Which cities exist in Europe? And whatβs the capital of Spain?
β These queries were a great exercise in joining foreign keys across the city
and country
tables.
7. Which countries have the lowest population density?
β I calculated custom metrics (Population / SurfaceArea)
β a real-world use case for derived fields.
8. Which cities have a higher-than-average GDP per capita?
β This was the most advanced query: combining JOIN
, WHERE
, AVG()
, and a nested subquery.
9. Can we rank cities beyond just the top 10?
β Using OFFSET
and ROW_NUMBER()
, I implemented SQL-based pagination β an essential concept in web and dashboard applications.
π‘ What I Gained
This project helped me strengthen my ability to:
Write clean, logical SQL queries
Ask data-driven questions and answer them with code
Use joins, aggregations, subqueries, and calculated fields
Communicate findings in a clear, organized way
π View the Full Project on GitHub
You can explore the full SQL breakdown, queries, explanations, and code structure here:
π GitHub Repository β WorldDBSQL