Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Name:- Kaushal Kumar Ganesh

Reg. No.:- 11916381


Course:- CAP280
CA2
Q.N.1 Answer:-

First create the table and insert the values for both the given table, then to list the Empno, Ename, Sal,
Daily sal of all emps in the asc order of Annsal do the following :-

select empno ,ename ,sal,sal/30,12*sal annsal from emp order by annsal asc;
Q.N.5 Answer:-

To List all the emps except ‘PRESIDENT’ & ‘MGR” in asc order of Salaries we have to do the following:-

select * from emp where job not in ('PRESIDENT','MANAGER') order by sal asc;

Q.N.23 Answer:-
As there is no Exp, Dname and grade in the emp table we have to add three columns and put values in
them, to do so we have to alter and update the table.
ALTER TABLE emp ADD exp int;

update emp set exp=500 where empno=7369;


ALTER TABLE emp ADD dname varchar2(50);

update emp set dname= OPERATIONS where deptno=40;


ALTER TABLE emp ADD grade int;

update emp set grade=4 where sal between 500 and 0;


Our emp table is updated now. To list the Empno, Ename, Sal, Dname, Grade, Exp, and Ann Sal of emps
working for Dept10 or 20 :-
Select empno, ename, sal, dname, grade, exp, 12*sal annsal from emp where deptno=10 or deptno=20;

You might also like