查询MYSQl数据表中的最后一条记录

mysql:

select * from table order by id DESC limit 1

oracle:

select * from emp where id in (select max(id) from emp);

 

实例:

mysql> use weifeng;
Database changed


mysql> select * from tb_post order by id desc limit 10 \G;


*************************** 1. row ***************************
             id: 24897419
      bloggerId: 287172
        likeNum: 52
       postTime: 2016-03-24 16:01:07
spiderFetchTime: NULL
       postRank: NULL
         showId: NULL
     platformId: 1
 postPlatformId: 1_b1d88acb5e5a21ed70785c41f3d5fe25
   sourcePostId: NULL
       mediaUrl: https://weifeng-hangzhou.aliyuncs.com/data_infra/ins/5d846f9ff66cf46ebbe115f91892bb08.jpg
          width: 1080
         height: 809
       fileSize: 245829
     averageHue: 0x4f4838
      mediaType: 0
    textContent: Senior Camp 2016🌅
        postUrl: https://www.instagram.com/p/BDVAwpSksNi
       orderNum: 0
        postTag: NULL
       videoUrl: NULL
  favoriteCount: 0
         status: 1
   accessStatus: 8
     created_at: 2018-09-19 04:12:30
     updated_at: 2018-09-19 04:12:30
     deleted_at: NULL

 

posted @ 2018-09-19 22:02  Oops!#  阅读(21998)  评论(0编辑  收藏  举报