1.into 插入语句
创建一个新表,并包含原表的两列数据
if OBJECT_ID('tb_jishu') is not null
drop table tb_jishu
select 国家,产品 into tb_jishu from jishu
select * from tb_jishu
2.[ ],[^]通配符,betweeen
select * from table where age like '2[2-4]'--22,23,24岁
select * from table where age between 22 and 24
select * from table where age like '2[^2-4]'--不在22,23,24
select * from table where age not between 22 and 24
3.any,some,all
>all,大于最大值,>any/>some,大于最小值
4.top
select top 3 * from jishu--返回表的前3行
5.union 合并表查询
6.根据不同条件更新同一字段
update testdate
set num1=
(case
when name=1 then 10
when name=2 then 20
when name=3 then 30
END)
where 0=0
update testdate set num2 =
(case
when name like '%jing%' then
(case
when name like '%xia%' then 40
when name not like '%xia%' then 30
end)
when name not like '%jing%' then 20
end)