SQL學(xué)習(xí)筆記3:查詢前幾條數(shù)據(jù),模糊查詢,查詢排序,區(qū)間查詢

--查詢前幾條數(shù)據(jù)
select top 數(shù)字? from 表名
模糊查詢:
%:匹配0個(gè)到任意的字符
select * from 表名 where 列名 like '%內(nèi)容%'
_:匹配1個(gè)字符
select * from 表名 where 列名 like '__'
查詢排序:
order by 根據(jù)那列進(jìn)行排序? (ASC:升序? ? DESC:降序)
select * from 表名 order by id desc//根據(jù)id降序
區(qū)間查詢:
between ... and ...:在...到...之間的數(shù)據(jù)
select * from 表名 where age between 10 and 20
標(biāo)簽: