FOR FREE CONTENT

SQL ASSINGMENT 9 WITH SOLUTION

Back to Programming

Description

Employee (EMP_NO, ENAME, JOB, MGR, SALARY, DEPT_NO, COMM)

 

a)     Find the total number of employees.

 

b)     Determine which department have more than two people holding a particular job.

 

c)     Find all department that have at least 1 staff.

 

d)     Delete row from employee table where deptno is 19.

 

e)     Delete all rows from employee table then Drop the emp table.

 

f)      Find all manager not in deptno 20.



CREATE TABLE EMPLOYEE:

CREATE TABLE EMPLOYEE (

EMPNO

NUMBER(5) PRIMARY KEY,

ENAME VARCHAR(50),

JOB VARCHAR(25),

MGR NUMBER(5) ,

SALARY NUMBER(10),

DEPTNO NUMBER(5),

COMM NUMBER(5) ); 


Table EMPLOYEE is created.


EMPLOYEE 



Insert the values in the table "EMPLOYEE":

INSERT INTO Employee VALUES(101, 'JONES’, ‘MANAGER’,101,10000,20,500)

INSERT INTO Employee VALUES(106, 'RAM’, ‘STAFF’,50,12000,19,750)

INSERT INTO Employee VALUES(110, 'BHABESH’, ‘MANAGER’,110,10000,20,200)

INSERT INTO Employee VALUES(102, 'KAPIL’, ‘STAFF’,205,16000,20,900)

INSERT INTO Employee VALUES(105, 'SHYAM’, ‘MANAGER’,105,17500,15,500) ;



Output:

5 rows created


Code