CREATE TABLE ... **EMPTY** AS SELECT

**Use case**

Create a table with the same structure as SELECT query returns but don't fill it.

**Describe alternatives you've considered**

CREATE TABLE ... AS DESCRIBE (SELECT ...)

\- more consistent but also more clunky.
{
    if (create.as_table_function)
        return;
    if (create.is_dictionary || create.is_ordinary_view || create.is_live_view || create.is_window_view)
        return;
    if (create.is_materialized_view && create.to_table_id)
        return;
    if (create.temporary)
    {
        if (create.storage && create.storage->engine && create.storage->engine->name != "Memory")
            throw Exception(ErrorCodes::INCORRECT_QUERY, "Temporary tables can only be created with ENGINE = Memory, not {}",
                create.storage->engine->name);
        
        
        
        
        if (create.storage && !create.storage->engine)
            throw Exception(ErrorCodes::INCORRECT_QUERY, "Invalid storage definition for temporary table: must be either ENGINE = Memory or empty");
        auto engine_ast = std::make_shared<ASTFunction>();
        engine_ast->name = "Memory";
        engine_ast->no_empty_args = true;
        auto storage_ast = std::make_shared<ASTStorage>();
        storage_ast->set(storage_ast->engine, engine_ast);
        create.set(create.storage, storage_ast);