mysql中如何查询表的第一条和最后一条记录

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

SELECT createdtime FROM `Z_2015-09-15` WHERE deviceid='460040271516782' limit 1;

SELECT createdtime FROM `Z_2015-09-15` WHERE deviceid='460040271516782' order by id DESC limit 1;