You are on page 1of 15

INTRODUCTION TO ORACLE EMPLOYEE TABLE E.NO 101. 102. 103. 104. 105.

NAME KIMMI SAHIL MEETA KARAN PIYUSH JOB MANAGER CLERK ANALYST SALESMAN PRESIDENT SALARY 8000 4000 3000 2000 9000

QUERIES:CREATE TABLE
(1) create table employee(enumber numeric(5),ename vachar2(7), ejob char(7),esalary number(9));

INSERT THE COMMANDS
(1) insert table employee values(`101`,`kimmi`,`manager`,`8000`); insert table employee values(`102`,`sahil`,`clerk`,`4000`); insert table employee values(`103`,`meeta`,`analyst`,`3000`); insert table employee values(`104`,`karan`,`salesman`,`2000`); insert table employee values(`105`,`piyush`,`president`,`9000`);

. SELECTING THE COLUMNS (9)select(esal) FROM employee. ROLLBACK COMMAND (7)roll back. (4)Desc employee. COMMIT COMMAND (6)Commit. DROP THE TABLE (10)DROP TABLE EMPLOYEE.VIEW THE TABLE (4)desc employee. MODIFYING COLUMNS (8)ALTER TABLE EMPLOYEE MODIFY(job desg varchar2(9)). SELECTING THE COLOUMS (5)Select *from employee. ALTER THE TABLE VIEW THE TABLE (3)alter table employee add(e-mail char (10)).

. EMP EMP NO.Ename Dept. . LOCATION OF THOSE EMPLOYEE WHO BELONGS TO `SALES DEPT.`(ALIASES AND JOINTS). . DEPT DEPT NO. Emp. E NAME JOB SALARY HIRE DATE DEPT NO.Loc FROM emp.Dept no.ORACLE`S PRACTICAL QUESTIONS (1)CONSIDER THE TABLE EMPLOYEE AND DISPLAY THE QUERY THAT DISPLAY EMP NO.Dept WHERE Dept.no=Dept.Dept.Emp No.NAME.Ename=`sales` and Emp. .SALARY. D NAME LOC SOLUTION:- Select Emp.

job.(2)WRITE A QUERY TO DISPLAY THE NAME OF THE EMPLOYEE WHO GOT THE MAXIMUM SALARY. . SOLUTION:.sal FROM emp WHERE sal BETWEEN 2000 and 4000 ORDER by sal.Select Ename.Sal FROM Emp Where sal >= 3000. SOLUTION:- Select Ename. SOLUTION:.ORDER THE QUERY IN ASCENDING ORDER.ascending. (4)WRITE A QUERY TO DISPLAY NAME. (3)WRITE A QUERY TO DISPLAY ENAME AND SAL OF EMPLOYEE WHOSE SALARY IS GREATER THAN OR EQUAL TO 3000 FROM THE TABLE EMPLOYEE. SALARY OF WHOSE EMPLOYEE WHOSE SALARY IS BETWEEN 2000 AND 4000.Select Ename FROM Emp WHERE Sal=[Select max(Sal)from emp].

deptno FROM emp WHERE comm.(5)WRITE A QUERY TO DISPLAY EMPLOYEE NAME.Job.Sal FROM Emp WHERE Sal NOT BETWEEN 2000 and 4000.`SALESMAN`. Select Ename.`Salesman`.`Analyst`). SOLUTION:- Select Ename.sal. SOLUTION:Select Ename.OR `ANALYST` FROM TABLE EMPLOYEE. . SOLUTION:- (6)WRITE A QUERY TO DISPLAY EMPLOYEE NAME AND SALARY OF THOSE EMPLOYEE WHO DON`T HAVE THEIR SALARY IN THE RANGE OF 2000 TO 4000.Sal FROM Emp WHERE job IN (`Manager`. (7)WRITE A QUERY TO DISPLAY EMPLOYEE NAME.JOB AND SALARY WHOSE JOB IS EITHER `MANAGER`.SALARY AND DEPARTMENT NUMBER WHO ARE NOT GETTING COMMISION FROMTABLE EMPLOYEE. Is null.

no. .ename FROM emp WHERE Deptno. FROM emp WHERE ename like k%). (9)WRITE A QUERY TO DISPLAY THE NAME OF THOSE EMPLOYEES WHOSE SALARY IS GREATER THAN `SAHIL` SALARY. SOLUTION:- Select Ename FROM Emp WHERE Sal>(select sal from Emp where Ename=`SAHIL`).(8)WRITE A QUERY TO DISPLAY THE NAME AND NUMBER THOSE EMPLOYEE WHOSE NAME CONTAINS AS `K`. (10)WRITE A QUERY TO DISPLAY THE GRADE OF ALL THE EMPLOYEES BASED ON THE VALUES OF THE COLOUM JOB AS PER FOLLOWING SCHEMES:- JOB GRADE . =(Select Dept. SOLUTION:Select eno.

`C`.PRESIDENT MANAGER ANALYST SALESMAN SOLUTION:Select Decode(job.`D`) “GRADE” FROM emp. `MANAGER`.`B`. A B C D . `PRESIDENT. `SALESMAN`. `ANALYST`.`A`.