elasticsearch/docs/reference/query-languages/sql-syntax-show-tables.md
Liam Thompson b98606e712
[9.0] [docs] Migrate docs from AsciiDoc to Markdown (#123507) (#124124)
* [docs] Migrate docs from AsciiDoc to Markdown (#123507)

* delete asciidoc files

* add migrated files

* fix errors

* Disable docs tests

* Clarify release notes page titles

* Revert "Clarify release notes page titles"

This reverts commit 8be688648d.

* Comment out edternal URI images

* Clean up query languages landing pages, link to conceptual docs

* Add .md to url

* Fixes inference processor nesting.

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Co-authored-by: Liam Thompson <leemthompo@gmail.com>
Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com>
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
(cherry picked from commit b7e3a1e14b)

# Conflicts:
#	docs/build.gradle
#	docs/reference/migration/index.asciidoc
#	docs/reference/migration/migrate_9_0.asciidoc
#	docs/reference/release-notes.asciidoc
#	docs/reference/release-notes/9.0.0.asciidoc
#	docs/reference/release-notes/highlights.asciidoc

* Fix build file

* Really fix build file

---------

Co-authored-by: Colleen McGinnis <colleen.j.mcginnis@gmail.com>
2025-03-06 07:53:46 +01:00

102 lines
2.9 KiB
Markdown

---
mapped_pages:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-syntax-show-tables.html
---
# SHOW TABLES [sql-syntax-show-tables]
```sql
SHOW TABLES
[CATALOG [catalog_identifier | <1>
LIKE pattern]]? <2>
[INCLUDE FROZEN]? <3>
[table_identifier | <4>
LIKE pattern]? <5>
```
1. Catalog (cluster) identifier. Supports wildcards (`*`).
2. SQL LIKE pattern matching catalog names.
3. Whether or not to include frozen indices.
4. Single table (index or data stream) identifier or double-quoted multi-target pattern.
5. SQL LIKE pattern matching table names.
See [index patterns](/reference/query-languages/sql-index-patterns.md) for more information about patterns.
**Description**: List the tables available to the current user and their type.
```sql
SHOW TABLES;
catalog | name | type | kind
---------------+---------------+----------+---------------
javaRestTest |emp |TABLE |INDEX
javaRestTest |employees |VIEW |ALIAS
javaRestTest |library |TABLE |INDEX
```
Match multiple indices by using {{es}} [multi-target syntax](/reference/elasticsearch/rest-apis/api-conventions.md#api-multi-index) notation:
```sql
SHOW TABLES "*,-l*";
catalog | name | type | kind
---------------+---------------+----------+---------------
javaRestTest |emp |TABLE |INDEX
javaRestTest |employees |VIEW |ALIAS
```
One can also use the `LIKE` clause to restrict the list of names to the given pattern.
The pattern can be an exact match:
```sql
SHOW TABLES LIKE 'emp';
catalog | name | type | kind
---------------+---------------+----------+---------------
javaRestTest |emp |TABLE |INDEX
```
Multiple chars:
```sql
SHOW TABLES LIKE 'emp%';
catalog | name | type | kind
---------------+---------------+----------+---------------
javaRestTest |emp |TABLE |INDEX
javaRestTest |employees |VIEW |ALIAS
```
A single char:
```sql
SHOW TABLES LIKE 'em_';
catalog | name | type | kind
---------------+---------------+----------+---------------
javaRestTest |emp |TABLE |INDEX
```
Or a mixture of single and multiple chars:
```sql
SHOW TABLES LIKE '%em_';
catalog | name | type | kind
---------------+---------------+----------+---------------
javaRestTest |emp |TABLE |INDEX
```
List tables within remote clusters whose names are matched by a wildcard:
```sql
SHOW TABLES CATALOG 'my_*' LIKE 'test_emp%';
catalog | name | type | kind
-----------------+---------------+---------------+---------------
my_remote_cluster|test_emp |TABLE |INDEX
my_remote_cluster|test_emp_copy |TABLE |INDEX
```