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

1 Answer

0 votes
by (20.3k points)

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.