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:


Previous articleHow to create a Session Array() variable in PHP
Next articleSQL Distinct Keyword
Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!

Leave a Reply

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