select column1,column2, ... from table_name order by column1,column2,....
school数据库有一张ky表,表里有学生的ID,姓名,分数,地址,爱好
create table ky (id int,name varchar(10) primary key not null ,score decimal(5,2),address varchar(20),hobbid int(5));
insert into ky values(1,'liuyi',80,'beijing',2);
insert into ky values(2,'wangwu',90,'shengzheng',2);
insert into ky values(3,'lisi',60,'shanghai',4);
insert into ky values(4,'tianqi',99,'hangzhou',5);
insert into ky values(5,'jiaoshou',98,'laowo',3);
insert into ky values(6,'hanmeimei',10,'nanjing',3);
insert into ky values(7,'lilei',11,'nanjing',5);
select * from ky; //查询ky表
1.3关键字排序
按分数排序,默认不指定是升序排列
mysql>select id,name,score from ky order by score;