MYSQL Temporary Tables
Create Temporary Table
Temporary tables could be very useful to keep temporary data. Temporary tables option is available in MySQL version 3.23 and above.
Temporary table will be automatically destroyed when the session ends or connection is closed. The user can also drop temporary table.
Same temporary table name can be used in many connections at the same time, because the temporary table is only available and accessible by the client who creates that table.
The temporary table can be created in the following types
You can add indexes as you build the table:
IF NOT EXISTS key word can be used as mentioned below to avoid 'table already exists' error. But in that case table will not be created, if the table name which you are using already exists in your current session.