How can I delete MySQL temporary table?


As we know that MySQL temporary table would be deleted if the current session is terminated. But of still in between the session we want to delete the temporary table than with the help of the DROP statement we can delete the temporary table. It can be understood with the help of the following example −

Example

In this example, we are deleting the temporary table named ‘SalesSummary’ −

mysql> DROP TABLE SalesSummary;
Query OK, 0 rows affected (0.00 sec)

The above query will delete the table and it can be confirmed from the query below −

mysql> Select * from SalesSummary;
ERROR 1146 (42S02): Table 'query.SalesSummary doesn't exist

Updated on: 22-Jun-2020

451 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements