+3 votes
in Databases by (71.8k points)
retagged by
How can I create temporary table so that it gets deleted itself once session is closed?

1 Answer

+2 votes
by (71.8k points)
selected by
 
Best answer

The syntax for 'create table' in mysql is as follows...

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name xxxxxxxxxxxxxxxx

 xxxxxxxxxxxxxxxx represents other options.

So, to create temporary table, use keyword TEMPORARY. Such table will be visible only in your current database session and it will be automatically deleted when your connection is closed.


...