Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn The WHERE Clause Operators | Filtering Data
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to SQL (60/40)

bookThe WHERE Clause Operators

SQL supports a lot of conditional statements.

Less Than

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

Less Than or Equal to

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

Not Equal

The following example retrieves all non-Asian countries:

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

1. Which query returns the names of countries with a population equal to 2,424,200 using the '=' operator in the WHERE clause?

2. Which SQL query returns all countries that are not in Europe using the '<>' operator?

3. Write a SQL query to select the country name and population for all countries with a population between 5,000,000 and 50,000,000, inclusive. Use the BETWEEN operator.

question mark

Which query returns the names of countries with a population equal to 2,424,200 using the '=' operator in the WHERE clause?

Select the correct answer

question mark

Which SQL query returns all countries that are not in Europe using the '<>' operator?

Select the correct answer

question-icon

Write a SQL query to select the country name and population for all countries with a population between 5,000,000 and 50,000,000, inclusive. Use the BETWEEN operator.

SELECT name, populationFROM countryWHERE population5000000 AND 50000000;
name | population
--------------+-----------
Ukraine | 50456000
Paraguay | 5496000

Click or drag`n`drop items and fill in the blanks

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

What other SQL conditional operators are there?

Can you explain how to use the BETWEEN operator?

Can you show more examples of using IS NULL in SQL?

bookThe WHERE Clause Operators

Swipe to show menu

SQL supports a lot of conditional statements.

Less Than

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

Less Than or Equal to

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

Not Equal

The following example retrieves all non-Asian countries:

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

1. Which query returns the names of countries with a population equal to 2,424,200 using the '=' operator in the WHERE clause?

2. Which SQL query returns all countries that are not in Europe using the '<>' operator?

3. Write a SQL query to select the country name and population for all countries with a population between 5,000,000 and 50,000,000, inclusive. Use the BETWEEN operator.

question mark

Which query returns the names of countries with a population equal to 2,424,200 using the '=' operator in the WHERE clause?

Select the correct answer

question mark

Which SQL query returns all countries that are not in Europe using the '<>' operator?

Select the correct answer

question-icon

Write a SQL query to select the country name and population for all countries with a population between 5,000,000 and 50,000,000, inclusive. Use the BETWEEN operator.

SELECT name, populationFROM countryWHERE population5000000 AND 50000000;
name | population
--------------+-----------
Ukraine | 50456000
Paraguay | 5496000

Click or drag`n`drop items and fill in the blanks

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 3. ChapterΒ 3
some-alt