1:
mysql> select id,sum(num) from (select * from t1 union all select * from t2) t1 //union联合查询 两张表的同一字段的值的和
2:show status like 'com_select' //查询mysql执行了多少次select查询。
3:select count(distinct id) as cc from article where year(createtime)='2015' // 统计创建时间是2015年的文章的总数,使用主键id,也可以使用其他有索引的字段,比select count(*) 快
4: SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('database'); //建立FULLTEXT 全文索引后 使用示例,在articles 表中的title ,body匹配 database关键字(只针对英文)。