MySQL Table Structure: How to Display

To display the structure of a table in MySQL, you can use either the DESC command or the SHOW CREATE TABLE command.

  1. Use the DESC command:
DESC table_name;

This will display the names of each column in the table, as well as their data types, key information, default values, and more.

  1. Use the SHOW CREATE TABLE command:
SHOW CREATE TABLE table_name;

This will display the SQL statement used to create a table, including detailed information such as the table’s structure, constraints, indexes, and more.

Both of these methods can help you view the structure of tables in MySQL.

bannerAds