Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
SQL Between | Filtering Statements
SQL Tutorial for Beginners
course content

Contenido del Curso

SQL Tutorial for Beginners

SQL Tutorial for Beginners

1. Database & Introduction to Syntax
2. SQL Aggregate Functions
3. Filtering Statements

bookSQL Between

If you need to choose records with the value in some range, you can use BETWEEN command:

12
SELECT id FROM songs WHERE year BETWEEN 1970 AND 1990
copy

The result of this query is equal to:

12
SELECT id FROM songs WHERE year >= 1970 AND year <= 1990
copy

Note that it includes boundary values. You can use BETWEEN with NOT operator: С NOT BETWEEN A AND B, which is equal to С<A OR С>B.

SQL BETWEEN for strings

If you apply BETWEEN to string values, you'll get all records from the table between these fields. Test the next example

12
SELECT title FROM songs WHERE album BETWEEN 'Highway to Hell' AND 'If You Can Believe Your Eyes and Ears'
copy

Tarea

Find minimum, maximum, and average prices of the songs created in the last decade of the 20th century. Use BETWEEN operator.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 4
toggle bottom row

bookSQL Between

If you need to choose records with the value in some range, you can use BETWEEN command:

12
SELECT id FROM songs WHERE year BETWEEN 1970 AND 1990
copy

The result of this query is equal to:

12
SELECT id FROM songs WHERE year >= 1970 AND year <= 1990
copy

Note that it includes boundary values. You can use BETWEEN with NOT operator: С NOT BETWEEN A AND B, which is equal to С<A OR С>B.

SQL BETWEEN for strings

If you apply BETWEEN to string values, you'll get all records from the table between these fields. Test the next example

12
SELECT title FROM songs WHERE album BETWEEN 'Highway to Hell' AND 'If You Can Believe Your Eyes and Ears'
copy

Tarea

Find minimum, maximum, and average prices of the songs created in the last decade of the 20th century. Use BETWEEN operator.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 4
toggle bottom row

bookSQL Between

If you need to choose records with the value in some range, you can use BETWEEN command:

12
SELECT id FROM songs WHERE year BETWEEN 1970 AND 1990
copy

The result of this query is equal to:

12
SELECT id FROM songs WHERE year >= 1970 AND year <= 1990
copy

Note that it includes boundary values. You can use BETWEEN with NOT operator: С NOT BETWEEN A AND B, which is equal to С<A OR С>B.

SQL BETWEEN for strings

If you apply BETWEEN to string values, you'll get all records from the table between these fields. Test the next example

12
SELECT title FROM songs WHERE album BETWEEN 'Highway to Hell' AND 'If You Can Believe Your Eyes and Ears'
copy

Tarea

Find minimum, maximum, and average prices of the songs created in the last decade of the 20th century. Use BETWEEN operator.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

If you need to choose records with the value in some range, you can use BETWEEN command:

12
SELECT id FROM songs WHERE year BETWEEN 1970 AND 1990
copy

The result of this query is equal to:

12
SELECT id FROM songs WHERE year >= 1970 AND year <= 1990
copy

Note that it includes boundary values. You can use BETWEEN with NOT operator: С NOT BETWEEN A AND B, which is equal to С<A OR С>B.

SQL BETWEEN for strings

If you apply BETWEEN to string values, you'll get all records from the table between these fields. Test the next example

12
SELECT title FROM songs WHERE album BETWEEN 'Highway to Hell' AND 'If You Can Believe Your Eyes and Ears'
copy

Tarea

Find minimum, maximum, and average prices of the songs created in the last decade of the 20th century. Use BETWEEN operator.

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 3. Capítulo 4
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
some-alt