Select Values Between Two Values

Create Table Of Adventurers

-- Create table called adventurers
CREATE TABLE adventurers (
    -- string variable
    name varchar(255),
    -- integer variable
    age int,
    -- string variable
    race varchar(255)
)

Insert Rows

-- Insert into the table adventurers
INSERT INTO adventurers (name, age, race)
VALUES ('Fjoak Doom-Wife', 28, 'Human'),
       ('Alooneric Cortte', 29, 'Human'),
       ('Piperel Ramsay', 35, 'Elf'),
       ('Casimir Yardley', 14, 'Elf')

Get Values Between Two Values, Method 1

-- Get all rows from adventurers
SELECT * FROM adventurers
-- Where age is between 20 and 30
WHERE age BETWEEN 20 AND 30
nameagerace
Fjoak Doom-Wife28Human
Alooneric Cortte29Human

Get Values Between Two Values, Method 2

-- Get all rows from adventurers
SELECT * FROM adventurers
-- Where age is between 20 and 30
WHERE age >= 20 AND age <= 30
nameagerace
Fjoak Doom-Wife28Human
Alooneric Cortte29Human