SQL学习笔记3:查询前几条数据,模糊查询,查询排序,区间查询

--查询前几条数据
select top 数字 from 表名
模糊查询:
%:匹配0个到任意的字符
select * from 表名 where 列名 like '%内容%'
_:匹配1个字符
select * from 表名 where 列名 like '__'
查询排序:
order by 根据那列进行排序 (ASC:升序 DESC:降序)
select * from 表名 order by id desc//根据id降序
区间查询:
between ... and ...:在...到...之间的数据
select * from 表名 where age between 10 and 20