MySQL Temporary Table

MySQL Temporary Table

A temporary table is visible only to the current database session.
A temporary table is dropped automatically when the database session is closed.
A temporary table can also be dropped with the command: DROP TABLE tabel_name.

Create Temporary Table syntax

CREATE TEMPORARY TABLE IF NOT EXISTS table_name(column_name column_data_type) ;

Create Temporary Table example

CREATE TEMPORARY TABLE 
IF NOT EXISTS 
test_temp(
id int, 
name varchar(50)
);

Output

temporary TABLE created.