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
, SEQUENCE
, or VIEW
.
To show tables in a different database, use SHOW TABLES IN DatabaseName
.
Synopsis
- ShowTableStmt
- ShowLikeOrWhere
ShowTableStmt ::=
"SHOW" "FULL"? "TABLES" ("FROM" Identifier | "IN" Identifier )? ShowLikeOrWhere?
ShowLikeOrWhere ::=
"LIKE" SimpleExpr
| "WHERE" Expression
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.