How to Create SQL Temporary Tables with Values
To create a temporary table and assign values to it, you can use the following SQL statement:
CREATE TEMPORARY TABLE temp_table (
id INT,
name VARCHAR(50)
);
INSERT INTO temp_table (id, name)
VALUES (1, 'Alice'),
(2, 'Bob'),
(3, 'Charlie');
In the example above, a temporary table called temp_table is created using the CREATE TEMPORARY TABLE statement, with two columns, id and name. Data is then inserted into the temporary table using the INSERT INTO statement.
Please note that temporary tables are only valid within the current session and will be automatically destroyed when the session ends.