1./* Query database Test all table comments */
SELECT from WHERE Table_schema='test';
2, to query the table field comments
SELECT from WHERE table_name='class' and Table_schema=' test';
3, one-time query database "test" the following table comments and corresponding table field comments
SELECT from WHERE c.table_name= and T. ' Table_schema '='test';
4, used in the project, query the database of all tables related fields, properties
SELECT 'XX System'System_name, Table_comment table_comment, A.table_name, Column_comment, column_name , Case whenColumn_key='PRI' Then 'Y' ELSE 'N' ENDIs_key, Case whencolumn_name='ID' ORcolumn_name='created_by' Then 'automatically' ELSE 'Manual' ENDGet_type, Column_type from(SELECT * fromInformation_schema. COLUMNSWHERETable_schema='Test') A Left JOIN(SELECTTable_name,table_comment fromInformation_schema. TABLESWHERETable_schema='Test') b onA.table_name=B.table_nameORDER byTable_name,ordinal_position;
MySQL uses SQL statements to query the database for all table annotations, etc.