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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:31:18
Original
979 people have browsed it

bitsCN.com

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

 

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

所有字段获取:

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

或者

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

笨方法:

单个获取

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

 

 

bitsCN.com
Related labels:
source:php.cn
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