Membership and Range Operators  with World Database
Membership and Range Operators  with World Database Data Science Project
Advanced SQL

Membership and Range Operators with World Database

This project is focused on the powerful `IN` and `BETWEEN` operators using the world database. Explore real-world data to filter countries by language, region, or economic factors while uncovering global insights. This hands-on project will boost your SQL skills through targeted, dynamic data queries.
Start this project
Membership and Range Operators  with World DatabaseMembership and Range Operators  with World Database
Project Created by

Adeyinka Odiaka

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.

codevalidated

Retrieve all countries that are either in the continents `Asia`, or `Oceania`.

Write a SQL query that selects the Name and Continent columns from the country table. Then filter for countries in Asia or Oceania.

The first few rows of your result should match this image:

codevalidated

List all cities located in countries with codes `USA`, `CAN`, or `MEX`.

Retrieve the Name and CountryCode of cities from the city table whose CountryCode match USA, CAN, or MEX.

Your output should match the image below:

codevalidated

Which Countries Have English, French, or Spanish as Their Official Language?

From the countrylanguage table, write a query that selects the Language, CountryCode and IsOfficial of countries where the official language is English, French, or Spanish. Fetch only rows where the language is one of the three specified and where it's marked True (T)as the official language.

Your output should match the image below:

input

How many countries are run by a constitutional monarchy?

From the country table, count the total number of rows where the GovernmentForm matches Constitutional Monarchy.

codevalidated

Retrieve the GNP and Previous GNP for USA and Japan

Select the Name, GNP, and GNPOld values from the country table for countries with the codes USA and JPN.

Your output should match the image below:

input

How Many Countries are in the Caribbean and Southeast Asia?

Count the total number of countries located in either the Caribbean or Southeast Asia regions in the country table; using the IN operator for filtering multiple regions.

codevalidated

Find all countries with a population between 60 million and 90 million.

From the country table, retrieve all countries with a population between 60 million and 90 million.

Your output should match the image below

codevalidated

Retrieve cities that have a population between 1 million and 5 million.

Select cities with populations between 1 million and 5 million from the city table.

The first few rows of your output should match the image below:

codevalidated

Which Countries Enjoy a Life Expectancy Between 80 and 90 Years?

Filter the LifeExpectancy column in the country table for a life expectancy between 80 and 90 years.

Your output should match the image below:

codevalidated

List countries who gained independence between the 1700s and the 1800s.

Filter the IndepYear column in the country table to capture the specified time frame for independence.

Your output should match the iumage below:

codevalidated

Get all countries where surface area is between 800,000 and 2 million km².

Use the BETWEEN operator to filter the SurfaceArea column in the country table for the specified criteria, and order the results in descending order by SurfaceArea.

Your output should match the image below:

codevalidated

Retrieve countries with life expectancy between 40 and 60 and show the GNP-to-population ratio as the alias `GNP_Per_Capita`

Calculate the GNP-to-population ratio and display it as GNP_Per_Capita. Filter the LifeExpectancy column in the country table to select countries with a life expectancy between 40 and 60 years.

Your output should match the image below:

codevalidated

List all countries in `Asia` and `Europe` that have a population between 1 million and 2 million.

Retrieve the Name, Continent and Population of countries in the country table located in Asia and Europe with populations between 1 million and 2 million.

Your output should match the image below

codevalidated

Which Countries in the West Enjoy Long Lives?

From the country table, retrieve the Name, LifeExpectancy and Region of countries in Western Europe and North America with a life expectancy between 70 and 80 years.

Your output should match the image below:

codevalidated

Which Republics Have a GNP Between 1 million and 10 Million?

Retrieve countries with a GNP between 1 and 10 million and a government form of either Republic or Federal Republic from the country table.

Your output should match the image below

codevalidated

Find Countries in Asia or Africa with a Population Between 5 and 20 Million

Filter the country table using both the IN and BETWEEN operators to retrieve the Name, Continent, and Population of countries located in either Asia or Africa with populations between 5 and 20 million

The first few rows of your output should match the image below:

codevalidated

Which Monarchies Reign with a GNP Under 10,000?

You're to retrieve countries with a government form of Monarchy and a GNP between 1,000 and 10,000 from the country table, ordering the results in descending order by GNP.

Your output should match the image below

Membership and Range Operators  with World DatabaseMembership and Range Operators  with World Database
Project Created by

Adeyinka Odiaka

Hey there, I'm Ade. Think of me as a data detective on a mission to uncover the secrets hidden in numbers. I love the feeling of uncovering hidden stories within data. It's like being a detective, but with spreadsheets and algorithms.I'm on a mission

Hey there, I'm Ade. Think of me as a data detective on a mission to uncover the secrets hidden in numbers. I love the feeling of uncovering hidden stories within data. It's like being a detective, but with spreadsheets and algorithms.I'm on a mission

This project is part of

Advanced SQL

Explore other projects