CREATE OWN LIBRARY

SQL ASSINGMENT 3 WITH SOLUTION

Back to Programming

Description

1)  Employee (EMPNO, ENAME, JOB, DEPTNO, SAL)

a)   Modify the column width of the job field.

b)   Update the Employee table to set the salary of all employees to Rs. 15000 who are working as ASP.

c)    Delete only those who are working as lecturer.

d)    List the records in the Employee table order by salary in ascending order.

e)    Display the names of those whose salary is in between 15000 to 30000.

Display the names of those whose salary is not between 15000 to 300.


CREATE Table EMPLOYEE:

CREATE TABLE EMPLOYEE (

Employee_id

NUMBER(5) PRIMARY KEY,

ENAME VARCHAR(50),

JOB VARCHAR(5),

DEPTNO VARCHAR(5),

SALARY NUMBER(5);

 

Table EMPLOYEE is created.


EMPLOYEE



Insert the values in the table "EMPLOYEE":

INSERT INTO Employee VALUES(110, 'RAM', ‘ASP’,’CSE’,10000)

INSERT INTO Employee VALUES(102, 'BIMAL', ‘LECTURER’,’EE’,35000)

INSERT INTO Employee VALUES(150, 'KAMAL', ‘LECTURER’,’CSE’,40000)

INSERT INTO Employee VALUES(116, 'MONA’,‘ASP’,’ME’,12500)

INSERT INTO Employee VALUES(197, 'HARI', ‘PROFESSOR’,’EE’,18000)

INSERT INTO Employee VALUES(123, 'RAMESH', ‘ASP’,’ECE’,11000) ;


Output:

6 rows created



Code