执行顺序
参考:http://www.tuicool.com/articles/fERNv2
1、数据库备份
记住加个owner,高效
导出sql exp abc/111111@orcl file=E:\wtkjjd.dmp owner = maeipuser 导入sql imp system/123456@orcl file=d:\daochu.dmp full=y ignore=y 指定导出用户,导入用户 imp scott/sss@orcl fromuser=JSUSER touser=scott file=d:\Desktop\0221.dmp ignore=y
2、in、any、all
子查询中的in,any,all select * from orderinfo where userid in (select userid from userinfo where username = 'abcd')与sqlserver一样 select * from orderinfo where userid > any (select userid from userinfo where username = 'abcd') 只要userid大于任何一个子查询中的userid则返回数据行 select * from orderinfo where userid > all(select userid from userinfo where username ='abcd') userid必须大于子查询中所有的userid才能返回数据行
3、自然连接natural join
select o.orderid,u.userid from orderinfo o natural join userinfo u where o.orderid = 1 oracle把两个表中名称相同的列自动连接
4、case when 使用
CASE WHEN sex = '1' THEN '男' WHEN sex = '2' THEN '女' ELSE '其他' END
5、decode函数
decode(性别,男,1,0) decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值) IF 条件=值1 THEN RETURN(翻译值1) ELSIF 条件=值2 THEN RETURN(翻译值2) ......
6、误删恢复sql
insert into sh_cases select * from sh_cases AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '100' MINUTE);原文链接:https://www.f2er.com/oracle/210994.html