# 60: UNKNOWN_TABLE (code 60)

> The table you queried or referenced is missing from the database the query reached.

Source: https://sqlly.app/errors/clickhouse/table-not-exists
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).
Note: Quoted error message text belongs to its database vendor.

- Error code: `60`
- Name: `UNKNOWN_TABLE`
- Category: Tables, columns and metadata

Error message:

```text
Unknown table expression identifier '{table}'. In scope {query}.
```

## What it means

`UNKNOWN_TABLE` (60) means the server cannot resolve a table name in the current database or the one you qualified. It is the ClickHouse twin of `no such table` in other engines. The database is fine (that failure is `UNKNOWN_DATABASE`, 81); only the table name fails. When a table with that name exists in another database, the server adds `Maybe you meant {database}.{table}?` before the scope clause. DDL and INSERT against a missing table report `Table {database}.{table} does not exist.` with the same code 60.

## Common causes

- A typo in the table name, or the wrong database in the connection string.
- The query hit a different server or tenant where the table was never created.
- A Distributed table points at a shard where the local table is missing, so the remote query fails with this code.

## How to fix it

1. List what the server actually sees and compare against your query.

   ```sql
   SELECT database, name FROM system.tables WHERE name ILIKE '%my_table%';
   ```
2. Qualify the table with its database so the default database of the session stops mattering.

   ```sql
   SELECT count() FROM my_db.my_table;
   ```
3. If a shard is missing its local table, create it on that shard's host before querying the Distributed table.

   ```sql
   CREATE TABLE my_table (id UInt64) ENGINE = MergeTree ORDER BY id;
   ```

## Reproduce it safely

```sql
CREATE TABLE scratch_b (id UInt32) ENGINE = MergeTree ORDER BY id; then run SELECT * FROM scratch_b_wrong and you get code 60.
```

## How SQLly helps

SQLly's schema tree lists what the connected server actually has, so a typo or a wrong default database shows up before you run the query.

## Questions

### Can case sensitivity cause this?

Yes. ClickHouse table, database and column names are case sensitive, so MyTable and mytable are different names.

### Why does the error mention the wrong database?

Unqualified names resolve against the session default database, which may differ from the one you had in mind.

## Related errors

- [`57`](https://sqlly.app/errors/clickhouse/table-already-exists): TABLE_ALREADY_EXISTS (code 57)
- [`16`](https://sqlly.app/errors/clickhouse/no-such-column-in-table): NO_SUCH_COLUMN_IN_TABLE (code 16)

The code and message text are from the [ClickHouse documentation (system.errors)](https://clickhouse.com/docs/en/operations/system-tables/errors).
