正则查询:
查询某个字段不全为中文
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