Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2023-09-10 17:09:03
forward
634 people have browsed it

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template