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.temporary && create.database)
        throw Exception("Temporary tables cannot be inside a database. You should not specify a database for a temporary table.",
            ErrorCodes::BAD_DATABASE_FOR_TEMPORARY_TABLE);
    String current_database = getContext()->getCurrentDatabase();
    auto database_name = create.database ? create.getDatabase() : current_database;
    
    if (create.attach && !create.storage && !create.columns_list)
    {
        auto database = DatabaseCatalog::instance().getDatabase(database_name);
        if (database->getEngineName() == "Replicated")
        {
            auto guard = DatabaseCatalog::instance().getDDLGuard(database_name, create.getTable());
            if (auto * ptr = typeid_cast<DatabaseReplicated *>(database.get());
                ptr && !getContext()->getClientInfo().is_replicated_database_internal)
            {
                create.setDatabase(database_name);
                guard->releaseTableLock();
                return ptr->tryEnqueueReplicatedDDL(query_ptr, getContext(), internal);
            }
        }
        bool if_not_exists = create.if_not_exists;
        
        auto query = database->getCreateTableQuery(create.getTable(), getContext());
        auto create_query = query->as<ASTCreateQuery &>();
        if (!create.is_dictionary && create_query.is_dictionary)