SQL查询表中最后一条数据

SQL查询表中最后一条数据

文章目录

准备数据表

建立student表,并插入几条数据

查询最后一条数据

本文共分为三种方式

//max(id) 函数
select * from student where id = (select max(id) from student);

//order by id desc limit 1
select * from student order by id desc limit 1;

//last_insert_id() 函数
select * from student where id = (select last_insert_id());
    原文作者:九离⠂
    原文地址: https://blog.csdn.net/qq_43410878/article/details/124144264
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞