Home  >  Article  >  Database  >  How can we get the column list from an existing MySQL table?

How can we get the column list from an existing MySQL table?

WBOY
WBOYforward
2023-08-30 15:29:16956browse

我们如何获取现有 MySQL 表中的列列表?

Suppose we forget the column names in the existing table, then we can use the SHOWCOLUMNS statement to get the list of columns -

mysql> SHOW COLUMNS from Employee\G

*************************** 1. row ***************************
  Field: Id
   Type: int(11)
   Null: YES
    Key:
Default: NULL
  Extra:
*************************** 2. row ***************************
  Field: Name
   Type: varchar(20)
   Null: YES
    Key:
Default: NULL
  Extra:

2 rows in set (0.07 sec)

In the above example, we obtained the column list of the "Employee" table with the help of SHOW COLUMNS statement.

The above is the detailed content of How can we get the column list from an existing MySQL table?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete