Skip to content

[Feature Request]: implement temporary table #23251

@iamlinjunhong

Description

@iamlinjunhong

Is there an existing issue for the same feature request?

  • I have checked the existing issues.

Is your feature request related to a problem?

Describe the feature you'd like


✅ Example of a MySQL Temporary Table

1. Create a temporary table

CREATE TEMPORARY TABLE tmp_users (
    id INT PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(50),
    age INT
);

2. Insert data

INSERT INTO tmp_users (name, age) VALUES ('Alice', 23), ('Bob', 30);

3. Query the temporary table

SELECT * FROM tmp_users;

4. Update the temporary table

UPDATE tmp_users SET age = 31 WHERE name = 'Bob';

5. Drop the temporary table (optional)

Temporary tables are automatically removed when the session ends, but you can drop them manually:

DROP TEMPORARY TABLE IF EXISTS tmp_users;

📌 Notes

  • Visible only within the current session. Other sessions cannot see it.
  • Automatically deleted when the connection closes.
  • Temporary tables can have the same name as regular tables without conflict:
  • When a temporary table and a regular table share the same name, SHOW TABLES displays the regular table, but SQL operations (SELECT/INSERT/UPDATE/DELETE) prefer to use the temporary table.

Describe implementation you've considered

No response

Documentation, Adoption, Use Case, Migration Strategy

Additional information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions