SQL Temporary Tables



The temporary tables could be exceptionally valuable at times to keep transitory information. An essential thing that ought to be known for impermanent tables is that they will be erased when the present customer session ends.

Brief tables were included MySQL from 3.23. On the off chance that you utilize a more seasoned adaptation of MySQL than 3.23, you can’t utilize transitory tables, however, you can utilize load tables.
As expressed before, provisional tables will just keep going the length of the session is alive. On the off chance that you run the code in a PHP script, the makeshift table will be devastated naturally when the script gets done with executing. On the off chance that you are associated with the MySQL database server through the MySQL customer project, then the provisional table will exist until you close the customer or physically crush the table.


Here is an example showing you usage of the temporary table.

The same code can be applied in  PHP scripts using mysql_query() function as it works the same in both the cases:-

Dropping Temporary Tables:


By default, all the temporary tables are deleted by MySQL when your database connection gets terminated. You can do it manually by issuing DROP TABLE command.

Following is the example of dropping a temporary table:


Facebook Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.