Create Temporary Table

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, 'Human', 'Bow'),
       ('Piperel Ramsay', 35, 'Elf', 'Bow'),
       ('Casimir Yardley', 14, 'Elf', 'Bow')

Create Temporary Table From Original Table

-- Create a temporary table called adventurers_temp that...
CREATE TEMP TABLE adventurers_temp AS
-- Contains all rows and columns from adventurers
SELECT * FROM adventurers

View Temporary Table

-- Retrieve all rows and columns from temporary table
SELECT * FROM adventurers_temp
nameageraceweapon
Fjoak Doom-Wife28HumanAxe
Alooneric Cortte29HumanBow
Piperel Ramsay35ElfBow
Casimir Yardley14ElfBow