Course Content
SQL Tutorial for Beginners
SQL Tutorial for Beginners
SQL Between
If you need to choose records with the value in some range, you can use BETWEEN command:
SELECT id FROM songs WHERE year BETWEEN 1970 AND 1990
The result of this query is equal to:
SELECT id FROM songs WHERE year >= 1970 AND year <= 1990
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
SELECT title FROM songs WHERE album BETWEEN 'Highway to Hell' AND 'If You Can Believe Your Eyes and Ears'
Swipe to show code editor
Find minimum, maximum, and average price
s of the songs created in the last decade of the 20th century. Use BETWEEN
operator.
Thanks for your feedback!
SQL Between
If you need to choose records with the value in some range, you can use BETWEEN command:
SELECT id FROM songs WHERE year BETWEEN 1970 AND 1990
The result of this query is equal to:
SELECT id FROM songs WHERE year >= 1970 AND year <= 1990
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
SELECT title FROM songs WHERE album BETWEEN 'Highway to Hell' AND 'If You Can Believe Your Eyes and Ears'
Swipe to show code editor
Find minimum, maximum, and average price
s of the songs created in the last decade of the 20th century. Use BETWEEN
operator.
Thanks for your feedback!
SQL Between
If you need to choose records with the value in some range, you can use BETWEEN command:
SELECT id FROM songs WHERE year BETWEEN 1970 AND 1990
The result of this query is equal to:
SELECT id FROM songs WHERE year >= 1970 AND year <= 1990
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
SELECT title FROM songs WHERE album BETWEEN 'Highway to Hell' AND 'If You Can Believe Your Eyes and Ears'
Swipe to show code editor
Find minimum, maximum, and average price
s of the songs created in the last decade of the 20th century. Use BETWEEN
operator.
Thanks for your feedback!
If you need to choose records with the value in some range, you can use BETWEEN command:
SELECT id FROM songs WHERE year BETWEEN 1970 AND 1990
The result of this query is equal to:
SELECT id FROM songs WHERE year >= 1970 AND year <= 1990
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
SELECT title FROM songs WHERE album BETWEEN 'Highway to Hell' AND 'If You Can Believe Your Eyes and Ears'
Swipe to show code editor
Find minimum, maximum, and average price
s of the songs created in the last decade of the 20th century. Use BETWEEN
operator.