order by 语句的使用
order by语句一定要放在每个select语句的最后,因为order by 是最后的条件了,即所有的查询条件都执行完了,数据都被找到了之后,最后决定如何输出的一步语句,所以放在最后
SELECT * FROM score ORDER BY math ASC
SELECT * FROM score WHERE `name` LIKE '韩%' ORDER BY (chinese + english + math )ASC
SELECT `name`,(chinese + english + math) AS total_score FROM score ORDER BY total_score DESC
多条件进行order by
-- ?按照部门号升序而雇员的工资降序排列 , 显示雇员信息
SELECT * FROM emp
ORDER BY deptno ASC , sal DESC;