oracle中create table with as和insert into with as语句
发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,oracle支持使用with as 子句来创建表语法:create table table_name aswith clause_name as(select query )[, clause_nam
千家信息网最后更新 2025年01月20日oracle中create table with as和insert into with as语句
oracle支持使用with as 子句来创建表
语法:
create table table_name as
with clause_name as
(select query )
[, clause_name1 as
(select query ) ...]
select column1,...columnn from clause_name;
语法:
insert into table_name
with clause_name as
(select query )
[, clause_name1 as
(select query ) ...]
select column1,...columnn from clause_name;
例子:
--create with 语句
CREATE TABLE w_test_20 AS WITH data_info_19 AS (SELECT NVL(ename,'unknow employee') AS ename, DECODE(deptno,10,'ACCOUNTING',20,'RESEARCH',30,'SALES',40,'OPERATIONS','no this department') AS dname, NVL(job,'unkown job') AS job , substr(to_char(hiredate,'yyyy-mm-dd'),1,7) AS hiredate, CASE WHEN sal <= 1000 THEN 'D' WHEN sal > 1000 AND sal <= 2000 THEN 'C' WHEN sal > 2000 AND sal <= 3000 THEN 'B' WHEN sal > 3000 THEN 'A' ELSE 'unkown grade' END AS grade, ROUND(sal,2) AS sal, FLOOR(nvl(comm,0)) AS comm, NVL(sal,0)+NVL(comm,0) AS total_sal FROM emp WHERE deptno IN (SELECT DISTINCT deptno FROM dept)) SELECT * FROM data_info_19;
CREATE TABLE w_test_18 AS WITH dept_info AS (SELECT deptno AS deptno_1,dname FROM dept),emp_info AS(SELECT empno AS empno_1,ename,job,deptno FROM emp),other_info AS(SELECT empno,hiredate,NVL(sal,0)+NVL(comm,0) AS total_sal FROM emp )SELECT * FROM dept_info d LEFT JOIN emp_info e ON d.deptno_1=e.deptno RIGHT JOIN other_info o ON e.empno_1=o.empno ;
INSERT INTO w_test_19WITH data_info_19 AS (SELECT NVL(ename,'unknow employee') AS ename, DECODE(deptno,10,'ACCOUNTING',20,'RESEARCH',30,'SALES',40,'OPERATIONS','no this department') AS dname, NVL(job,'unkown job') AS job , substr(to_char(hiredate,'yyyy-mm-dd'),1,7) AS hiredate, CASE WHEN sal <= 1000 THEN 'D' WHEN sal > 1000 AND sal <= 2000 THEN 'C' WHEN sal > 2000 AND sal <= 3000 THEN 'B' WHEN sal > 3000 THEN 'A' ELSE 'unkown grade' END AS grade, ROUND(sal,2) AS sal, FLOOR(nvl(comm,0)) AS comm, NVL(sal,0)+NVL(comm,0) AS total_sal FROM emp WHERE deptno IN (SELECT DISTINCT deptno FROM dept)) SELECT * FROM data_info_19;
INSERT INTO w_test_18 WITH dept_info AS (SELECT deptno AS deptno_1,dname FROM dept),emp_info AS(SELECT empno AS empno_1,ename,job,deptno FROM emp),other_info AS(SELECT empno,hiredate,NVL(sal,0)+NVL(comm,0) AS total_sal FROM emp )SELECT * FROM dept_info d LEFT JOIN emp_info e ON d.deptno_1=e.deptno RIGHT JOIN other_info o ON e.empno_1=o.empno ;
语法
语句
例子
子句
支持
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
福建纵腾网络技术有限
传统网络安全问题
广州应用软件开发正规平台
现代网络技术使人疏远
百科论坛万方数据库
康复云软件开发公司
免费的服务器防护软件排行榜
尚游网络技术上海
手游服务器租赁
证券期货网络安全规划
孝感市服务器机柜
原来这就是网络安全
美国软件开发的工
数据库技术的意义和目的
互联网科技公司宣传页介绍
红舟服务器
苹果软件开发工作室
车俊 网络安全会议
计算机应用软件开发流程
工行软件开发中心
海南风战网络技术有限公司
网络安全情况调查
合睿网络技术有限公司
汽车电子应用软件开发
工业级服务器对空气环境要求
数据库子系统由什么组成
全民奇迹全服通用服务器
网络技术专业学什么好
网络安全web过滤
惠水数据库技术与应用