O'Reilly logo

Sams Teach Yourself MySQL by Chris Newman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Temporary Tables

A temporary table lasts only for the current MySQL session. Therefore, after you have disconnected from the database, the table will no longer be available after you reconnect. To create a temporary table, use CREATE TEMPORARY TABLE instead of CREATE TABLE.

Temporary tables are useful if you need to manipulate data using temporary storage within an application and you do not want the tables you use to remain on the system when you are finished with them.

A temporary table name can be used simultaneously in multiple MySQL sessions. Therefore, if two instances of your program run at the same time, it is not necessary to generate a unique name for the temporary table in each instance.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required