A temporary table allows a user to store temporary records and we can use these records several times until the session does not expire. They are useful in those situations when it is expensive to write a query having single SELECT Statement with Join clauses with it.
We use CREATE TEMPORARY TABLE statement to create a temporary table and we can use Drop Table statement to drop a temporary table.
CREATE TEMPORARY TABLE EMP
GROUP BY EMPName
ORDER BY Salary DESC
The above query will create a temporary table EMP which is created from Employee table.
Example to drop a temporary table:
DROP TEMPORARY TABLE EMP;
We can easily drop a temporary table using Drop Temporary Table statement but if we try to delete a permanent table using Drop Temporary Table statement then there will be a error.