Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2023-08-30 15:29:16
forward
1012 people have browsed it

我们如何获取现有 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)
Copy after login

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!

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