Home > Database > Mysql Tutorial > body text

mysql取得数据库所有表名和字段注释_MySQL

WBOY
Release: 2016-06-01 13:32:30
Original
1522 people have browsed it

bitsCN.com

mysql取得数据库所有表名和字段注释

 

1、取字段注释 

Java代码  

Select COLUMN_NAME 列名, DATA_TYPE 字段类型, COLUMN_COMMENT 字段注释  

from INFORMATION_SCHEMA.COLUMNS  

Where table_name = 'companies'##表名  

AND table_schema = 'testhuicard'##数据库名  

AND column_name LIKE 'c_name'##字段名   

 

2、取得表注释

Java代码  

Select table_name 表名,TABLE_COMMENT 表注释 from INFORMATION_SCHEMA.TABLES Where table_schema = 'testhuicard' ##数据库名   

AND table_name LIKE 'companies'##表名   

 

mysql手册:23.1. INFORMATION_SCHEMA表

3、取得某数据库下所有表的注释

Java代码  

$tt = mysql_query("show table status;");  

$table_info=array();  

while($re = mysql_fetch_array($tt,MYSQL_ASSOC)){  

                 //$re["Comment"],这个就是表的注释  

                 $table_info[] = $re;  

 } ......  

 

更新自增值 ALTER TABLE [Table]members AUTO_INCREMENT=10000

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