DB

正则查询:

查询某个字段不全为中文

select * from table where column REGEXP '[\u0391-\uFFE5]';(mysql)

select * from table where column like '%[\u0391-\uFFE5]%';(sqlserver)

空格

select * from table where column REGEXP ' ';(mysql)

select * from table where column like '% %';(sqlserver)

查询某个字段含有数字

select * from table where name regexp '[0-9]+.*';

 

oralce:

decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)

mysql:

方法一:

if(条件true,值1,否则值2)

方法二:

case sex  when 1  then '男'

                when 2 then '女'

                else '人妖'

            end  

case when sex=1 then '男'

        when sex=2 then '女'

        else '人妖'

        end


建新表:

方法一:

select * into t2 from t1    (只适用于sqlServer)

方法二:

create table t2 as select * from t1   (只适用于oracle)

方法三:

CREATE TABLE 新表SELECT * FROM 旧表WHERE 1=2 (mysql)

参考:https://blog.csdn.net/u012643122/article/details/52948460

 

转载于:https://my.oschina.net/u/2403498/blog/474590

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值