Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Using the AND Operator | Advanced Data Filtering
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

bookUsing the AND Operator

To filter on multiple columns, you must use the AND operator to add conditions to the WHERE clause. Let's see an example:

123
SELECT name, population, region FROM country WHERE population >= 1000000 AND continent ='Europe';
copy

This request retrieves only those rows that correspond to both conditions: countries where the population is greater than or equal to 1,000,000 and the continent is Europe.

Task

From the country table, retrieve only countries' names (column name) from Asia (can be checked in column continent) with a population greater than 1000000 (can be checked in column population). Please note you only need to output country names.

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 4. Chapter 1
toggle bottom row

bookUsing the AND Operator

To filter on multiple columns, you must use the AND operator to add conditions to the WHERE clause. Let's see an example:

123
SELECT name, population, region FROM country WHERE population >= 1000000 AND continent ='Europe';
copy

This request retrieves only those rows that correspond to both conditions: countries where the population is greater than or equal to 1,000,000 and the continent is Europe.

Task

From the country table, retrieve only countries' names (column name) from Asia (can be checked in column continent) with a population greater than 1000000 (can be checked in column population). Please note you only need to output country names.

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 4. Chapter 1
toggle bottom row

bookUsing the AND Operator

To filter on multiple columns, you must use the AND operator to add conditions to the WHERE clause. Let's see an example:

123
SELECT name, population, region FROM country WHERE population >= 1000000 AND continent ='Europe';
copy

This request retrieves only those rows that correspond to both conditions: countries where the population is greater than or equal to 1,000,000 and the continent is Europe.

Task

From the country table, retrieve only countries' names (column name) from Asia (can be checked in column continent) with a population greater than 1000000 (can be checked in column population). Please note you only need to output country names.

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!

To filter on multiple columns, you must use the AND operator to add conditions to the WHERE clause. Let's see an example:

123
SELECT name, population, region FROM country WHERE population >= 1000000 AND continent ='Europe';
copy

This request retrieves only those rows that correspond to both conditions: countries where the population is greater than or equal to 1,000,000 and the continent is Europe.

Task

From the country table, retrieve only countries' names (column name) from Asia (can be checked in column continent) with a population greater than 1000000 (can be checked in column population). Please note you only need to output country names.

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 4. Chapter 1
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt