maxhugen
maxhugen

Reputation: 1944

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. :(

Upvotes: 0

Views: 236

Answers (1)

A.D.
A.D.

Reputation: 2372

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

Upvotes: 1

Related Questions