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.
{
    std::lock_guard lock(mutex);
    return tables.empty();
}
StoragePtr DatabaseWithOwnTablesBase::detachTable(ContextPtr , const String & table_name)
{
    std::unique_lock lock(mutex);
    return detachTableUnlocked(table_name, lock);
}
StoragePtr DatabaseWithOwnTablesBase::detachTableUnlocked(const String & table_name, std::unique_lock<std::mutex> &)
{
    StoragePtr res;
    auto it = tables.find(table_name);
    if (it == tables.end())
        throw Exception(ErrorCodes::UNKNOWN_TABLE, "Table {}.{} doesn't exist",
                        backQuote(database_name), backQuote(table_name));
    res = it->second;
    tables.erase(it);
    auto table_id = res->getStorageID();
    if (table_id.hasUUID())
    {
        assert(database_name == DatabaseCatalog::TEMPORARY_DATABASE || getUUID() != UUIDHelpers::Nil);
        DatabaseCatalog::instance().removeUUIDMapping(table_id.uuid);
    }
    return res;
}
void DatabaseWithOwnTablesBase::attachTable(ContextPtr , const String & table_name, const StoragePtr & table, const String &)