https://www.cnblogs.com/ghost-xyx/p/3811036.html (不错的sql讲解个人网站)
https://github.com/Darylxyx (此人的github)
选择表中的最后一个数据,先倒序再加上limit;
mysql数据库:
SELECT column_name FROM table_name
ORDER BY column_name DESC
LIMIT 1;
sql server数据库:
SELECT TOP 1 column_name FROM table_name
ORDER BY column_name DESC;
Oracle数据库:
SELECT column_name FROM table_name
ORDER BY column_name DESC
WHERE ROWNUM <=1;
聚合函数avg()和having的结合使用
我们想查询平均年龄在20岁以上的班级