Mysql obtains all database table names and field comments bitsCN.com
Mysql obtains all table names and field comments of the database.
1. obtain field comments
Java code
Select COLUMN_NAME column name, DATA_TYPE field type, COLUMN_COMMENT field comment
From INFORMATION_SCHEMA.COLUMNS
Where table_name = 'companys' # table name
AND table_schema = 'testhuicard '# Database name
AND column_name LIKE 'c _ name' # Field name
2. get table comments
Java code
Select table_name table name, TABLE_COMMENT table comment from INFORMATION_SCHEMA.TABLES Where table_schema = 'testhuicard '# Database name
AND table_name LIKE 'companys' # table name
Mysql Manual: 23.1. INFORMATION_SCHEMA table
3. obtain comments of all tables in a database
Java code
$ Tt = mysql_query ("show table status ;");
$ Table_info = array ();
While ($ re = mysql_fetch_array ($ tt, MYSQL_ASSOC )){
// $ Re ["Comment"]. this is the Comment of the table.
$ Table_info [] = $ re;
}......
Update auto-increment alter table [Table] members AUTO_INCREMENT = 10000
BitsCN.com