I run this query
CREATE TEMPORARY TABLE usercount SELECT * FROM users
I get this message
Your SQL query has been executed successfully ( Query took 0.1471 sec )
But when I try to access the newly created table using
SELECT * FROM usercount
I get this error
#1146 - Table 'abc_site.usercount' doesn't exist
Not sure why, I need to mention that I've did a good share of googling beforehand.
My version of PHPMyAdmin is 3.5.2.2 and MySQL 5.5.27
In this example, we are going to create a temporary table whose structure is based on the already available tables in the database. Here, the structure of a temporary table is created by using the SELECT statement and merge two tables using the INNER JOIN clause and sorts them based on the price.
You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only within the current session, and is dropped automatically when the session is closed.
The use of temporary tables, or temp tables in SQL terms, is common in SQL, but once we're done with those tables, they should be deleted, or dropped. Using the DROP TABLE command on a temporary table, as with any table, will delete the table and remove all data.
PHPMyAdmin (or rather PHP) closes the database connection after each screen. Thus your temporary tables disappear.
You can put multiple SQL statements in the SQL query box in PHPMyAdmin; this should be executed as one block and thus the temporary table is not deleted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With