zoukankan      html  css  js  c++  java
  • Oracle_insert_delete_update

    Oracle_insert_delete_update
    --复制表格的结构
    create table temp as (select * from emp where 1=2);
    select * from temp;
    --删除表
    drop table temp;  
    插入
    --1.插入 新增
    insert into temp(empno, ename, job, hiredate, sal) values(1234, 'test张三', 'programer', sysdate, 12000 );
    insert into temp(empno, ename, job, hiredate, sal) values(1234, '张小夫老三', 'programer', sysdate, 12000 );
    insert into temp(empno, ename, job, hiredate, sal) values(1234, '张老三', 'programer', sysdate, 12000.9098 );
     
    insert into temp values(1111, '张sdf', 'student', '1233',to_date('2010-5-12','yyyy-mm-dd'), 2000,12000.9098,10);
     
     
    --1.2一次性插入多条记录
    insert into temp(select * from emp);
    select * from temp;  
    删除
    --2.删除表中的数据
    delete from temp;
    delete from temp where empno=7369;
     
    --2.2彻底删除表中的所有数据,不可回滚
    truncate table temp;  
    更新
    --3.更新
    --将30部门所有员工的薪水提升10%
    update temp set sal=sal + sal*2 where deptno = 30;
    select deptno, sal from emp where deptno = 30;
    select deptno, sal from temp where deptno = 30;
     
     
    update temp set ename='test', sal=8000 where empno=7369;
    select * from emp where empno=7369;
    select * from temp where empno=7369;   
  • 相关阅读:
    Lombok——一款Java构建工具,“懒人”必备!!(idea版)
    HTML——列表标签
    HTML——超链接<a>
    python 数据写入json文件时中文显示Unicode编码问题
    Spring——Bean的作用域
    过程与函数
    异常错误处理
    游标变量的使用
    =>符号的意义
    游标的使用
  • 原文地址:https://www.cnblogs.com/haozhengfei/p/6538363.html
Copyright © 2011-2022 走看看