1.排序:

为了方便查看数据,可以对数据进行排序

1.语法:

select * from 表名
order by 列1 asc|desc,列2,asc|desc,.......
将行数据按照列1进行排序,如果某些行列1的值相同时,则按照列2排序,以此类推
默认按照列值从小到大排列
asc从小到大排序,即升序
desc从大到小排序,即降序
查询未删除女生信息,按id号降序
select * from students
where gender=1 and isdelete
order by id desc;

MySQL基础之排序

2.查询未删除科目信息,按名称升序

select * from subject
where isdelete=0
order by stitle;

MySQL基础之排序

MySQL基础之排序

MySQL基础之排序

3.获取部分行:

当数据量过大时,在一页中查看数据是一件非常麻烦的事情
语法
select * from 表名
limit start,count
从start开始,获取count条数据
start搜引从0开始

MySQL基础之排序

MySQL基础之排序


 

 

 

 

 

 

 

 

 

 

相关文章:

  • 2022-12-23
  • 2021-04-22
  • 2021-07-21
  • 2021-08-06
  • 2021-07-01
  • 2021-08-09
  • 2021-06-02
猜你喜欢
  • 2022-02-09
  • 2021-11-29
  • 2021-07-18
  • 2021-11-30
  • 2021-08-18
  • 2021-09-14
相关资源
相似解决方案