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

来源:互联网 发布:淘宝大学紫米教育骗 编辑:程序博客网 时间:2024/05/01 22:16

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

原创粉丝点击