Using Apache Hive
Also available as:

Create a temporary table

Create a temporary table to improve performance by storing data outside HDFS for intermediate use, or reuse, by a complex query.

Temporary table data persists only during the current Apache Hive session. Hive drops the table at the end of the session. If you use the name of a permanent table to create the temporary table, the permanent table is inaccessible during the session unless you drop or rename the temporary table. You can create a temporary table having the same name as another user's temporary table because user sessions are independent. Temporary tables do not support partitioned columns and indexes.
  1. Create a temporary table having one string column.
    CREATE TEMPORARY TABLE tmp1 (tname varchar(64));
  2. Create a temporary table using the CREATE TABLE AS SELECT (CTAS) statement.
    CREATE TEMPORARY TABLE tmp2 AS SELECT c2, c3, c4 FROM mytable;
  3. Create a temporary table using the CREATE TEMPORARY TABLE LIKE statement.