mysqldatabaseschemadatabase-schema

How do I show the schema of a table in a MySQL database?


From the MySQL console, what command displays the schema of any given table?


Solution

  • For formatted output:

    describe [db_name.]table_name;
    

    For an SQL statement that can be used to create a table:

    show create table [db_name.]table_name;