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

Kursinnhold

Introduction to SQL

Introduction to SQL

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

book
The 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

Here is the country table we are working with:

Oppgave

Swipe to start coding

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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 3
toggle bottom row

book
The 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

Here is the country table we are working with:

Oppgave

Swipe to start coding

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.

Løsning

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 3. Kapittel 3
Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Vi beklager at noe gikk galt. Hva skjedde?
some-alt