orcal - 增删改

时间:2024-01-20 18:36:09
数据跟新
增删改
将emp复制到myemp
CREATE TABLE myemp AS SELECT * FROM emp;
新增:
INSERT INTO 表名称[(列名称1,列名称2,.....)] values[(值1,值2,..)]
字符串 ''
数字:1
日期:当前日期(sysdate)、使用to_date转换 完整格式()
INSERT INTO myemp
(empno,sal,job,comm,ename,mgr,hiredate,deptno)
VALUES(8888,9999.0,
'清洁工',10.0,
'张三',
7369,
to_date('2019-09-12','yyyy-MM-dd'),40);
设置null(或者不写)
INSERT INTO myemp
(empno,sal,job,comm,ename,mgr,hiredate,deptno)
VALUES(8888,9999.0,
'清洁工',10.0,
'张三',
7369,
null,40);
修改
UPDATE myemp set sal = 8000,comm=9000
where ename = 'SMITH' UPDATE myemp set sal = sal * 1.2
where sal < (select AVG(sal) from myemp); 数据删除
DELETE FROM myemp where empno = 7566;