資料庫
1. 查詢所有資料的大小: data_length: 資料大小 index_length: 索引大小
select concat(round(sum(data_length+index_length)/1024/1024,2),'mb') as data from information_schema.tables\g
2. 檢視指定資料庫的大小,比如檢視資料庫zabbix的大小:
select concat(round(sum(data_length+index_length)/1024/1024,2),'mb') as data from information_schema.tables where table_schema='zabbix'\g
3. 檢視指定資料庫的某個表的大小,比如檢視資料庫zabbix中history表的大小
select concat(round(sum(data_length+index_length)/1024/1024,2),'mb') as data from information_schema.tables where table_schema='zabbix' and table_name='history_uint'\g
4. 檢視指定表相關所有資訊
select * from information_schema.tables where table_schema='zabbix' and table_name='history'\g
表1. 查詢第一行記錄:
select * from table limit 1;
2. 查詢前n行記錄
select * from table limit 10;
或者select * from table limit 0,10;
mysql常用的查詢 MySQL常用查詢
select from unixtime create time,y m as time,sum sales amount sales amount sum from sales group by time 執行結果如下 查詢每年的銷售額 select from unixtime create ti...
mysql 查詢 常用 mysql常用查詢
一.group concat函式,以指定的分割符合並列,與group by 一起用 例 selectgroup concat c.columnname separator group by 二.preparedstatement.return generated keys 得到剛剛插入記錄的id p...
常用的mysql查詢
查詢中文匹配 select cooperator name,business manager id from tbl cooperator where hex business manager id regexp e 4 9 0 9a f 查詢商戶名全是中文的資料。select cooperator...