语法先后顺序:
From
On
Join
Where
--筛选
比较运算符:> < >= <= !=
逻辑运算符:and or
Group By
With Cube or With Rollup
Having
--跟在group by 后面
Select
Distinct
Order By
--排序(默认从低到高)desc(升序) asc(降序)
select *from 表名 roder by 列 desc
Top
--筛选前多少条
模糊查询:
like '%宝马%'
like '%宝马'
like '宝马%'
like '宝马__'
like '宝马[1-6]'
like '宝马[^1-6]'
去重查询:
select distinct 列 from 表名
子查询
join on
表连接 表与表之间有联系的列连接起来