0% found this document useful (0 votes)
6 views

Manipulating Data

Manuapalting data in python

Uploaded by

BUNTY SHELAR
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Manipulating Data

Manuapalting data in python

Uploaded by

BUNTY SHELAR
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1)create table emptest as(select * from emp);

2)insert into emptest(empno,ename,sal)


values(7843,'BINDU',5400);

3)update emptest set sal=(sal+(sal*0.15))


where ename='TURNER';

4)update emptest set sal= (select sal from emptest


where ename='SCOTT')
where ename='SMITH';

5)update emptest
set sal= (sal+(sal*0.1))
where deptno=(select deptno from dept
where loc='NEW YORK');

6)delete from emptest


where comm is not null;

7)delete from emptest


where deptno=(select deptno from dept
where dname='SALES');

8)DELETE FROM EMPTest


WHERE DEPTNO IN (SELECT DEPTNO FROM EMPTest WHERE DEPTNO=DEPTNO
AND EMPNO<>EMPNO AND ENAME='ENAME');

9)create table emp2


as select empno,ename,sal from emp
where 1=0;

10)create table emp3


as select empno,job from emp
where 1=0;

11)insert all into emp2(empno,ename,sal) values(empno,ename,sal)


into emp3(empno,job) values (empno,job)
select empno,ename,sal,job from emp;

12)truncate table emp2;


insert into emp2 (empno,ename,sal)
values (7788,'SMITH',4500);
insert into emp2(empno,ename,sal)
values (7654,'JACK',3500);

13)commit;

14)insert into emp2(empno,ename,sal)


values (empno,ename,sal)
select * from emp;

15)select * from emp2;

16)rollback;

17)merge into emp2


using (select empno from emp where deptno=20)
on(emp=empno)
when not matched then insert(empno,ename,sal)
values(7788,'SCOTT',3000)
where sal>3000;

18)select * from emp2;

19)create user WIPRO identified by wipro;

20)grant all privileges on emp to wipro;

21)delete from emp


where deptno=10;

22)delete from scott.emp where wipro and deptno=10;

23)rollback;

24)update emp
set sal=999
where ename='MILLER'
for update wait 20;

25)rollback;

26)rollback;

You might also like