Home >Database >Mysql Tutorial >如何获得mysql数据库的所有的列_MySQL

如何获得mysql数据库的所有的列_MySQL

WBOY
WBOYOriginal
2016-06-01 13:31:18951browse

bitsCN.com

如何获得mysql数据库的所有的列

 

SELECT  COLUMN_NAME FROM  `information_schema`.`COLUMNS` where  `TABLE_NAME`='appStats' order by COLUMN_NAME

 

 

所有字段获取:

 

SELECT COLUMN_NAME FROM 'information_schema'.'COLUMNS' where 'TABLE_SCHEMA'='数据库名称' and 'TABLE_NAME'='你的表名' order by COLUMN_NAME;

 

 

或者

 

select * from ’information_schema‘.’columns‘ where ’table_name‘='表名‘;

 

 

笨方法:

 

单个获取

 

$re_name_1=mysql_field_name($result,1);$re_name_2=mysql_field_name($result,2);

 

 

bitsCN.com
Statement:
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