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

SHOW TABLES - 图1

ShowLikeOrWhere

SHOW TABLES - 图2

  1. ShowTableStmt ::=
  2. "SHOW" "FULL"? "TABLES" ("FROM" Identifier | "IN" Identifier )? ShowLikeOrWhere?
  3. ShowLikeOrWhere ::=
  4. "LIKE" SimpleExpr
  5. | "WHERE" Expression

Examples

  1. mysql> CREATE TABLE t1 (a int);
  2. Query OK, 0 rows affected (0.12 sec)
  3. mysql> CREATE VIEW v1 AS SELECT 1;
  4. Query OK, 0 rows affected (0.10 sec)
  5. mysql> SHOW TABLES;
  6. +----------------+
  7. | Tables_in_test |
  8. +----------------+
  9. | t1 |
  10. | v1 |
  11. +----------------+
  12. 2 rows in set (0.00 sec)
  13. mysql> SHOW FULL TABLES;
  14. +----------------+------------+
  15. | Tables_in_test | Table_type |
  16. +----------------+------------+
  17. | t1 | BASE TABLE |
  18. | v1 | VIEW |
  19. +----------------+------------+
  20. 2 rows in set (0.00 sec)
  21. mysql> SHOW TABLES IN mysql;
  22. +-------------------------+
  23. | Tables_in_mysql |
  24. +-------------------------+
  25. | GLOBAL_VARIABLES |
  26. | bind_info |
  27. | columns_priv |
  28. | db |
  29. | default_roles |
  30. | expr_pushdown_blacklist |
  31. | gc_delete_range |
  32. | gc_delete_range_done |
  33. | global_priv |
  34. | help_topic |
  35. | opt_rule_blacklist |
  36. | role_edges |
  37. | stats_buckets |
  38. | stats_feedback |
  39. | stats_histograms |
  40. | stats_meta |
  41. | stats_top_n |
  42. | tables_priv |
  43. | tidb |
  44. | user |
  45. +-------------------------+
  46. 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