给MySQL的show table status结果做过滤

MySQL中可以使用 show table status 查看表的状态,但是不能像select 语句选出结果那样做结果过滤。

有没有办法像select语句那样过滤呢,答案是有的,就是从information_schema库的tables表中查询。

如下是模仿show table status 的SQL:

SELECT table_name,Engine,Version,Row_format,table_rows,Avg_row_length,
  Data_length,Max_data_length,Index_length,Data_free,Auto_increment,
  Create_time,Update_time,Check_time,table_collation,Checksum,
  Create_options,table_comment
FROM information_schema.tables
WHERE Table_Schema='MyDataBaseName';

注意替换MyDataBaseName的名称为自己的库名称,这样就可以方便在Where部分添加各种条件过滤了。

Popularity: 10% [?]

Random Posts

Comments

Comments are closed.