createtable student (id int, name varchar(20), age int, sex varchar(5),address varchar(100),math int,english int);insertinto student
(id,name,age,sex,address,math,english)values(1,'马云',55,'男','杭州',66,78),(2,'马化腾',45,'女','深圳',98,87),(3,'马景涛',55,'男','香港',56,77),(4,'柳岩',20,'女','湖南',76,65),(5,'柳青',20,'男','湖南',86,NULL),(6,'刘德华',57,'男','香港',99,99),(7,'玛德',22,'女','香港',99,99),(8,'德玛西亚',18,'男','南京',56,65);
语法
orderby 排序字段1,排序字段2,...排序字段n;
根据数学成绩排序(默认升序)
升序
select*from student orderby math;select*from student orderby math asc;
降序
select*from student orderby math desc;
按照数学成绩升序,如果成绩一样,按照英语成绩升序
select*from student orderby math asc, english asc;