本文介绍了如何在PHP中获取MySQL表结构?加上所有表格的清单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在PHP中运行什么查询才能获取数据库中给定表的结构?我需要运行什么查询才能获得所有表的列表?

What query do I need to run in PHP to get the structure of a given table in the database? And what query do I need to run to get a list of all the tables?

推荐答案

要获取表的列列表,请使用DESCRIBE SQL语句.语法如下:

To get a list of columns for a table, use the DESCRIBE SQL statement. The syntax is as follows:

DESCRIBE TableName

要获取数据库上的表列表,请使用以下SQL语句:

To get a list of tables on the database, use this SQL statement:

SHOW TABLES

这篇关于如何在PHP中获取MySQL表结构?加上所有表格的清单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 11:14