mysql查看表注释和字段注释的方法

1、取字段注释
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、取得表注释
Select table_name 表名,TABLE_COMMENT 表注释 from INFORMATION_SCHEMA.TABLES Where table_schema = 'testhuicard' ##数据库名
AND table_name LIKE 'companies'##表名
参考http://dev.mysql.com/doc/refman/5.1/zh/information-schema.html.
mysql手册:23.1. INFORMATION_SCHEMA表
3、取得某数据库下所有表的注释
       $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

 

本文转自http://blog.163.com/wumingli456@126/blog/static/28896414201231054116693/

posted @ 2014-11-18 13:54  雪山飞猪  阅读(3699)  评论(0编辑  收藏  举报