create-table

Create a temporary table in a SELECT statement without a separate CREATE TABLE

馋奶兔 提交于 2019-11-26 00:49:30
问题 Is it possible to create a temporary (session only) table from a select statement without using a create table statement and specifying each column type? I know derived tables are capable of this, but those are super-temporary (statement-only) and I want to re-use. It would save time if I did not have to write up a create table command and keep the column list and type list matched up. 回答1: CREATE TEMPORARY TABLE IF NOT EXISTS table2 AS (SELECT * FROM table1) From the manual found at http:/