SHOW-TABLES

Name

SHOW TABLES

Description

This statement is used to display all tables under the current db

grammar:

  1. SHOW TABLES [LIKE]

illustrate:

  1. LIKE: Fuzzy query can be performed according to the table name

Example

  1. View all tables under DB

    1. mysql> show tables;
    2. +---------------------------------+
    3. | Tables_in_demo |
    4. +---------------------------------+
    5. | ads_client_biz_aggr_di_20220419 |
    6. | cmy1 |
    7. | cmy2 |
    8. | intern_theme |
    9. | left_table |
    10. +---------------------------------+
    11. 5 rows in set (0.00 sec)
  2. Fuzzy query by table name

    1. mysql> show tables like '%cm%';
    2. +----------------+
    3. | Tables_in_demo |
    4. +----------------+
    5. | cmy1 |
    6. | cmy2 |
    7. +----------------+
    8. 2 rows in set (0.00 sec)

Keywords

  1. SHOW, TABLES

Best Practice