DESCRIBEEmployee\G******** ******************1.row**************************** Field: Id&am"/> DESCRIBEEmployee\G******** ******************1.row**************************** Field: Id&am">

Home  >  Article  >  Database  >  Is there any other statement in MySQL other than SHOW COLUMNS to get the list of columns in an existing table?

Is there any other statement in MySQL other than SHOW COLUMNS to get the list of columns in an existing table?

WBOY
WBOYforward
2023-09-10 17:09:03582browse

MySQL 中除了 SHOW COLUMNS 之外还有其他语句来获取现有表中的列列表吗?

Yes, we can use DESCRIBE or EXPLAIN statement instead of SHOW COLUMNS statement to get the existing table List of columns in . In the following example, we have applied the DESCRIBE and EXPLAIN statements on the "Employee" table and obtained the result set obtained after the SHOW COLUMNS statement Same result set -

mysql> DESCRIBE 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.05 sec)

mysql> Explain 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.04 sec)

The above is the detailed content of Is there any other statement in MySQL other than SHOW COLUMNS to get the list of columns in an existing 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