Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Checking for a Range of Values | 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
Checking for a Range of Values

To check for a range of values, we should use the BETWEEN operator. This operator requires two values: the start-value and the end-value of the range. Also, the AND keyword should be placed between these values.

Here is the syntax for using the BETWEEN operator:

sql

Let's see an example:

123
SELECT name, population FROM country WHERE population BETWEEN 100000 AND 3000000;
copy

Here is the country table we are working with:

Oppgave

Swipe to start coding

Write an SQL query that returns the name, capital, and population columns from the country table (please retrieve these columns in this order), for all countries with a population between 6000000 and 80000000. Then sort the result by capital from A to Z.

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 5
toggle bottom row

book
Checking for a Range of Values

To check for a range of values, we should use the BETWEEN operator. This operator requires two values: the start-value and the end-value of the range. Also, the AND keyword should be placed between these values.

Here is the syntax for using the BETWEEN operator:

sql

Let's see an example:

123
SELECT name, population FROM country WHERE population BETWEEN 100000 AND 3000000;
copy

Here is the country table we are working with:

Oppgave

Swipe to start coding

Write an SQL query that returns the name, capital, and population columns from the country table (please retrieve these columns in this order), for all countries with a population between 6000000 and 80000000. Then sort the result by capital from A to Z.

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 5
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