Tuesday , March 19 2024

MySQL Temporary Tables

The article contains information about the MySQL Temporary Tables used to create a temporary table in MySQL VTY system.

What is Temporary Tables in MySQL?

The Temporary Table feature in MySQL is used to create a virtual table where data is temporarily stored.

The temporary table created does not appear when the tables are listed by the list command.

The temporary table allows to use SELECT, INSERT, UPDATE, DELETE statements.

Temporary tables are deleted when the session expires, as in MySQL variables.

Create Temporary Table in MySQL

Creating a temporary table is created in a similar way to SQL table creation, with the TEMPORARY suffix in front of it.

The following statement is used to create a temporary table.

Temporary tables are used to store / process frequently used data.

Copy Table to Temporary Table in MySQL

Copying existing tables to temporary tables is similar to copying SQL tables. It is copied by putting the TEMPORARY prefix in front of it.

The following statement is used to copy a table.

You can also use it in the following ways.

Temporary table names can be the same as existing table names.

That is, even if there is a table named category, you can create a temporary table named category.

However, when the categories table is listed, the data in the temporary table are listed.

Also, the data added to the temporary table will be deleted when the session ends, so it may give undesired results.

Loading

About Yusuf SEZER

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories