简体   繁体   中英

MySQL Specify Temp Table Engine When Using AS

Is it possible to specify the Engine when using CREATE TEMPORARY TABLE xxx AS (SELECT ...) ? I tried but this fails:

CREATE TEMPORARY TABLE test AS (
SELECT myCol
FROM myTable
) ENGINE = MEMORY;

I've searched for an example of this but to no avail, using AS . :(

This is possible with simple syntax CREATE TABLE t AS SELECT ... - you will need to specify table columns in full statement, Sample:

CREATE TEMPORARY TABLE test (myCol varchar(100)) 
ENGINE=MEMORY 
AS 
SELECT myCol FROM myTable;

ref

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM