DB2个人学习笔记

按条件返回记录

select bank_id from table1 where SEQ = 419;

返回前十条记录

select * from table1 where id <> '03090000' fetch first 10 rows only;

返回10-20的记录

select * from table1 where id <> '03090000' and id not in (select id from table1 where id <> '03090000' fetch first 10 rows only) fetch first 10 rows only;

like及count

select count(*) from table1  where id <> '03090000' and name like '%测试%'; "%" 可用于定义通配符(模式中缺少的字母)

select * from tbl_ccp_bank_stat_inf where bank_nm not like '%农%';
distinct

select distinct name from table1; 

between和like、or、oder by

select *  from table1 where id between '14040000' and '14385500' and name like '%农%';

select *  from table1 where id between '14040000' and '14385500' or name like '%农%' order by id;

插入数据

insert into table1 values(624,'11111111','个人',0,0,'20130314','6','1') ; 其中,624和0、0是Integer,带' ' 的为char和varchar

更新数据

update  table1  set seq = 622,id='22222222',name='人民' where seq = 611;
删除数据

delete from  table1   where seq = 633;

通配符

select * from  table1 where name  like '_1%';  _代表一个字符
in

select *  table1  where name in('农业','技术');


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值