select 语句

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值