工作常用sql语句

来源:互联网 发布:mac怎么显示桌面图标 编辑:程序博客网 时间:2024/06/08 06:55
复制表数据(substr截取字符串)

insert into SQ_GE_BUILDING_TEMP(BUILDING_ID,ADDR,BUILDING_NAME)(select ID,substr(addr,6),building_name from sq_ge_building)

比对两张表数据

select t.*,b.jzwb from SQ_GE_BUILDING_TEMP t,buile_test b where  t.building_name=b.jzwmc  and   t.addr=b.tdzl

分组统计数据

select t.addr,count(*) from SQ_GE_BUILDING t group by addr

清空表数据

delete from 表;

某列置空

update 表 set 列 =null where 条件;

多列更新

update 表 set ( name=2,sex=1) where 条件;

多表统计
        select
         ( select count(*) from sq_ge_personinfo  ) as  personifoCount,
         ( select count(*) from sq_ge_building  ) as buildingCount,
         (select count(*)  from sq_ge_rpr ) as rprCount,
         (select count(*)  from SQ_ZMMB ) as zmmbCount,
         (select count(*)  from SYS_USER ) as userCount,
         (select count(*)  from SQ_INFORMATION ) as informationCount,
         (select count(*)  from SQ_DAILYFOLLOWUP ) as daiLyFollowUpCount
        from dual




0 0
原创粉丝点击