Skip to content

Latest commit

 

History

History
94 lines (72 loc) · 2.5 KB

sql-statement-show-tables.md

File metadata and controls

94 lines (72 loc) · 2.5 KB
title summary aliases
SHOW [FULL] TABLES | TiDB SQL Statement Reference
An overview of the usage of SHOW [FULL] TABLES for the TiDB database.
/docs/dev/sql-statements/sql-statement-show-tables/
/docs/dev/reference/sql/statements/show-tables/

SHOW [FULL] TABLES

This statement shows a list of tables and views in the currently selected database. The optional keyword FULL indicates if a table is of type BASE TABLE or VIEW.

To show tables in a different database, use SHOW TABLES IN DatabaseName.

Synopsis

ShowTablesStmt:

ShowTablesStmt

OptFull:

OptFull

ShowDatabaseNameOpt:

ShowDatabaseNameOpt

ShowLikeOrWhereOpt:

ShowLikeOrWhereOpt

Examples

mysql> CREATE TABLE t1 (a int);
Query OK, 0 rows affected (0.12 sec)

mysql> CREATE VIEW v1 AS SELECT 1;
Query OK, 0 rows affected (0.10 sec)

mysql> SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| t1             |
| v1             |
+----------------+
2 rows in set (0.00 sec)

mysql> SHOW FULL TABLES;
+----------------+------------+
| Tables_in_test | Table_type |
+----------------+------------+
| t1             | BASE TABLE |
| v1             | VIEW       |
+----------------+------------+
2 rows in set (0.00 sec)

mysql> SHOW TABLES IN mysql;
+-------------------------+
| Tables_in_mysql         |
+-------------------------+
| GLOBAL_VARIABLES        |
| bind_info               |
| columns_priv            |
| db                      |
| default_roles           |
| expr_pushdown_blacklist |
| gc_delete_range         |
| gc_delete_range_done    |
| global_priv             |
| help_topic              |
| opt_rule_blacklist      |
| role_edges              |
| stats_buckets           |
| stats_feedback          |
| stats_histograms        |
| stats_meta              |
| stats_top_n             |
| tables_priv             |
| tidb                    |
| user                    |
+-------------------------+
20 rows in set (0.00 sec)

MySQL compatibility

The SHOW [FULL] TABLES statement in TiDB is fully compatible with MySQL. If you find any compatibility differences, report a bug.

See also