AI & ML for Managers - Flat 70% OFF   Offer ends in

SQL Tutorial

54 / 59
   

Temporary Tables

  • Used to store temporary data.
  • Table and data are deleted when the current client session terminates.
  • Not listed in the output of SHOW TABLES command.

Example:

create temporary table salessummary (
   -> product_name varchar(50) not null
   -> , total_sales decimal(12,2) not null default 0.00
);

Insert some data and select the same.

Now log out of the session or log back in. Try to select the data. You will see there is no such table or data.