You can execute the SHOW statement to view information about databases, such as database lists and tables.

SHOW DATABASES

  • Syntax
    SHOW DATABASES [EXTRA];            

    You can specify the EXTRA parameter to view extra information about the databases, such as the IDs of the creators and the connection information.

  • Example
    SHOW DATABASES EXTRA;
    +--------------------+
    | Database           |
    +--------------------+
    | adb_demo           |
    | MYSQL              |
    | INFORMATION_SCHEMA |
    | adb_demo2          |           

SHOW TABLES

You can execute the SHOW TABLES statement to view the tables in the current database.

  • Syntax
    SHOW TABLES [IN db_name];          
  • Example
    SHOW TABLES IN adb_demo;
    +------------------------------+
    | Tables_in_adb_demo           |
    +------------------------------+
    | customer                     |
    | customer2                    |
    | new_customer                 |
    | test_table                   |
    | v                            |           

SHOW COLUMNS

You can execute the SHOW COLUMNS statement to view the columns in a table.

  • Syntax
    SHOW COLUMNS IN db_name.table_name;        
  • Example
    SHOW COLUMNS IN adb_demo.test_table;         

SHOW CREATE TABLE

You can execute the SHOW CREATE TABLE statement to view the statement that is used to create a table.

  • Syntax
    SHOW CREATE TABLE db_name.table_name;          
  • Example
    SHOW CREATE TABLE adb_demo.customer;           

SHOW GRANTS

You can execute the SHOW GRANTS statement to view the permissions that are granted to the current account.

SHOW GRANTS;