# table\_exists

## Syntax

```
table_exists(in_db_name,in_table_name, out_table_type)

# in_db_name VARCHAR(64)
# in_table_name VARCHAR(64)
# out_table_type ENUM('', 'BASE TABLE', 'VIEW', 'TEMPORARY')
```

## Description

`table_exists` is a [stored procedure](/docs/server/server-usage/stored-routines/stored-procedures.md) available with the [Sys Schema](/docs/server/reference/system-tables/sys-schema.md).

Given a database *in\_db\_name* and table name *in\_table\_name*, returns the table type in the `OUT` parameter *out\_table\_type*. The return value is an `ENUM` field containing one of:

* '' - the table does not exist
* '`BASE TABLE`' - a regular table
* '`VIEW`' - a view
* '`TEMPORARY`' - a temporary table

## Examples

```sql
CALL sys.table_exists('mysql', 'time_zone', @table_type); SELECT @table_type;
+-------------+
| @table_type |
+-------------+
| BASE TABLE  |
+-------------+

CALL sys.table_exists('mysql', 'user', @table_type); SELECT @table_type;
+-------------+
| @table_type |
+-------------+
| VIEW        |
+-------------+
```

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/system-tables/sys-schema/sys-schema-stored-procedures/table_exists.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
