---
title: "Schema"
description: "This function checks whether a table is defined in the current database."
canonical_url: "https://surrealdb.com/docs/reference/query-language/functions/database-functions/schema"
section: "Database functions"
surrealdb_version: "4.x"
last_modified: "2026-11-27T03:18:50Z"
---

> Full SurrealDB documentation index: https://surrealdb.com/docs/llms.txt

# Schema

This function checks whether a table is defined in the current database.

_(since v3.0.0)_

# Schema functions

These functions inspect the schema of the current database.

<table>
  <thead>
    <tr>
      <th scope="col">Function</th>
      <th scope="col">Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td scope="row" data-label="Function"><a href="#schematableexists"><code>schema::table::exists()</code></a></td>
      <td scope="row" data-label="Description">Checks if a table is defined in the current database</td>
    </tr>
  </tbody>
</table>

## `schema::table::exists`

The `schema::table::exists` function checks if a table is defined in the current database. It returns `true` for a table created with `DEFINE TABLE`, and `false` for any other name.

```syntax title="API DEFINITION"
schema::table::exists(string) -> bool
```

The following example shows this function, and its output:

```surql
-- Setup
DEFINE TABLE person;

schema::table::exists('person');
//- true

schema::table::exists('missing');
//- false
```
