Use Column Aliases With Where Clause

Create Table

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

Insert Rows

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

Retrieve Two Columns

The trick is to wrap the column aliasing in paratheses.

-- Retrieve rows from
SELECT * FROM
    -- Create alias for columns
    (
      -- Retrieve name and weapon column, renamed full_name and primary_weapon
      SELECT name as full_name, weapon as primary_weapon FROM adventurers
    )
    -- with the alias called biological_data
    AS biological_data
-- Where the values in the alias column is 'Axe'
WHERE primary_weapon = 'Axe'
full_nameprimary_weapon
Fjoak Doom-WifeAxe