摘要: --合并两张表的内容 merge into new_table using old_table on (new_table.id = old_table.id) when matched then update newtable .... when not matched then insert n 阅读全文
posted @ 2020-02-16 21:23 admin_jh 阅读(1165) 评论(0) 推荐(0) 编辑
摘要: 统计不同产品类别在不同月份的销量:pivot 和 unpivot CREATE OR REPLACE VIEW AQKCCKL_NEW_FIN_V AS SELECT T.*, NVL(T.M1,0)+NVL(T.M2,0)+NVL(T.M3,0)+NVL(T.M4,0)+NVL(T.M5,0)+N 阅读全文
posted @ 2020-02-16 20:48 admin_jh 阅读(384) 评论(0) 推荐(0) 编辑
摘要: --层次化查询,利用伪列level和lpad函数来判断 select level,lpad(' ',2 * level - 1) || last_name from more_employees --这里可以加where条件查询 start with employee_id = (select em 阅读全文
posted @ 2020-02-16 18:40 admin_jh 阅读(242) 评论(0) 推荐(0) 编辑
摘要: --translate(p1,p2,p3):p2中查找p1中的内容匹配到之后转换到p3的位置内容 select translate('I am a student', 'abcdefghijklmnopqrstuvwxyz', 'zyxwvutsrqponmlkjihgfedcba') from d 阅读全文
posted @ 2020-02-16 18:17 admin_jh 阅读(359) 评论(0) 推荐(0) 编辑