Skip to content

Latest commit

 

History

History
88 lines (72 loc) · 2.4 KB

sql-statement-show-tables.md

File metadata and controls

88 lines (72 loc) · 2.4 KB
title summary aliases
SHOW [FULL] TABLES
TiDB 数据库中 SHOW [FULL] TABLES 的使用概况。
/docs-cn/dev/sql-statements/sql-statement-show-tables/
/docs-cn/dev/reference/sql/statements/show-tables/

SHOW [FULL] TABLES

SHOW [FULL] TABLES 语句用于显示当前所选数据库中表和视图的列表。可选关键字 FULL 说明表的类型是 BASE TABLESEQUENCE 还是 VIEW

若要在不同的数据库中显示表,可使用 SHOW TABLES IN DatabaseName 语句。

语法图

ShowTableStmt ::=
    "SHOW" "FULL"? "TABLES" ("FROM" Identifier | "IN" Identifier )? ShowLikeOrWhere?

ShowLikeOrWhere ::=
    "LIKE" SimpleExpr
|   "WHERE" Expression

示例

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 兼容性

SHOW [FULL] TABLES 语句与 MySQL 完全兼容。如发现任何兼容性差异,请尝试 TiDB 支持资源

另请参阅