Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
The WHERE Clause Operators | Filtering Data
Introduction to SQL
course content

Course Content

Introduction to SQL

Introduction to SQL

1. Retrieving Data
2. Sorting Retrieved Data
3. Filtering Data
4. Advanced Data Filtering
5. Aggregate Functions

bookThe WHERE Clause Operators

SQL supports a lot of conditional statements.

Let’s look at the examples:
This example lists all countries that have a population of less than 2424200:

123
SELECT name, population FROM country WHERE population < 2424200;
copy

The following example retrieves all countries with a population less than or equal to 2424200:

123
SELECT name, population FROM country WHERE population <= 2424200;
copy

The following example retrieves all non-Asian countries:

123
SELECT name, continent FROM country WHERE continent<>'Asia';
copy

Task

Write an SQL query to retrieve the name, population, region, and capital columns from the country table (please retrieve these columns in this order), returning only the countries with a region named Southern Europe.

Note

Please note that Southern Europe should be correctly capitalized, and southern europe should not be the same. So, be careful and write it as Southern Europe.

Here's a short example of the country table:

idnamecontinentregionsurfaceareacapitalpopulation
1JapanAsiaEastern Asia377829Tokyo126714000
2LatviaEuropeNULL64589Riga2424200
3MexicoNorth AmericaCentral America1958201Mexico City98881000
.....................
15MaltaEuropeSouthern Europe316Valletta380200

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 3
toggle bottom row

bookThe WHERE Clause Operators

SQL supports a lot of conditional statements.

Let’s look at the examples:
This example lists all countries that have a population of less than 2424200:

123
SELECT name, population FROM country WHERE population < 2424200;
copy

The following example retrieves all countries with a population less than or equal to 2424200:

123
SELECT name, population FROM country WHERE population <= 2424200;
copy

The following example retrieves all non-Asian countries:

123
SELECT name, continent FROM country WHERE continent<>'Asia';
copy

Task

Write an SQL query to retrieve the name, population, region, and capital columns from the country table (please retrieve these columns in this order), returning only the countries with a region named Southern Europe.

Note

Please note that Southern Europe should be correctly capitalized, and southern europe should not be the same. So, be careful and write it as Southern Europe.

Here's a short example of the country table:

idnamecontinentregionsurfaceareacapitalpopulation
1JapanAsiaEastern Asia377829Tokyo126714000
2LatviaEuropeNULL64589Riga2424200
3MexicoNorth AmericaCentral America1958201Mexico City98881000
.....................
15MaltaEuropeSouthern Europe316Valletta380200

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 3
toggle bottom row

bookThe WHERE Clause Operators

SQL supports a lot of conditional statements.

Let’s look at the examples:
This example lists all countries that have a population of less than 2424200:

123
SELECT name, population FROM country WHERE population < 2424200;
copy

The following example retrieves all countries with a population less than or equal to 2424200:

123
SELECT name, population FROM country WHERE population <= 2424200;
copy

The following example retrieves all non-Asian countries:

123
SELECT name, continent FROM country WHERE continent<>'Asia';
copy

Task

Write an SQL query to retrieve the name, population, region, and capital columns from the country table (please retrieve these columns in this order), returning only the countries with a region named Southern Europe.

Note

Please note that Southern Europe should be correctly capitalized, and southern europe should not be the same. So, be careful and write it as Southern Europe.

Here's a short example of the country table:

idnamecontinentregionsurfaceareacapitalpopulation
1JapanAsiaEastern Asia377829Tokyo126714000
2LatviaEuropeNULL64589Riga2424200
3MexicoNorth AmericaCentral America1958201Mexico City98881000
.....................
15MaltaEuropeSouthern Europe316Valletta380200

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SQL supports a lot of conditional statements.

Let’s look at the examples:
This example lists all countries that have a population of less than 2424200:

123
SELECT name, population FROM country WHERE population < 2424200;
copy

The following example retrieves all countries with a population less than or equal to 2424200:

123
SELECT name, population FROM country WHERE population <= 2424200;
copy

The following example retrieves all non-Asian countries:

123
SELECT name, continent FROM country WHERE continent<>'Asia';
copy

Task

Write an SQL query to retrieve the name, population, region, and capital columns from the country table (please retrieve these columns in this order), returning only the countries with a region named Southern Europe.

Note

Please note that Southern Europe should be correctly capitalized, and southern europe should not be the same. So, be careful and write it as Southern Europe.

Here's a short example of the country table:

idnamecontinentregionsurfaceareacapitalpopulation
1JapanAsiaEastern Asia377829Tokyo126714000
2LatviaEuropeNULL64589Riga2424200
3MexicoNorth AmericaCentral America1958201Mexico City98881000
.....................
15MaltaEuropeSouthern Europe316Valletta380200

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 3. Chapter 3
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt