-- Creating a temporary table.
CREATE TEMPORARY TABLE temp_test_table(id serial, value double precision);

-- Inserting some data to the temporary table.
INSERT INTO temp_test_table(value)
SELECT random()
FROM generate_series(1,10);

-- Selecting data from the temporary table.
SELECT AVG(value) FROM temp_test_table;

-- Dropping the temporary table.
-- Note: All temporary tables gets removed when the session ends, 
-- i.e when the connection is closed.
DROP table temp_test_table;